Solved

Stairs

Make an n by n matrix, where the elements are ones and zeros. In the main diagonal, and under that, there should be only ones (...

2 years ago

Solved

Vectorize the digits of an Integer

Create a vector of length N for an integer of N digits. x = 123045; x_vec = [1 2 3 0 4 5]; I happened upon a trick ...

2 years ago

Solved

execute the declaration in strings and return value

execute the commands in strings and return value input='a=23' output=23

2 years ago

Solved

Alternately upper-lower case

Modify the string to alternate between upper and lower case. For example, s='achyuta' output='AcHyUtA'

2 years ago

Solved

interesting center of magic matrix

output the centre of magic matrix of n input=7; output=25

2 years ago

Solved

most frequent character

Obtain the most frequent character. For example, s='balaram'; output='a'; If there is a tie between letters, return t...

2 years ago

Solved

Sum the 'edge' values of a matrix

Sum the 'edge' values of an input matrix (the values along the perimeter). Example [1 2 3 4 5 6 7 8 9] Output = ...

2 years ago

Solved

Change the sign of even index entries of the reversed vector

change the signs of the even index entries of the reversed vector example 1 vec = [4 -1 -2 9] ans = [9 2 -1 -4] example2...

2 years ago

Solved

Symmetry of vector

Determine whether the vector is symmetric or not (vector could be even or odd in length). For example: x = [1 2 3 3 2 1] ...

2 years ago

Solved

Insert zeros into vector

Insert zeros after each elements in the vector. Number of zeros is specified as the input parameter. For example: x = [1 ...

2 years ago

Solved

Sum the real and imaginary parts of a complex number

Sum the real and imaginary parts of a complex number. Example c = 1+2i has the solution 1 + 2 = 3

2 years ago

Solved

Determine the length of a string of characters

Determine the length of a string of characters

2 years ago

Solved

Select every other element of a vector (★★)

(copy of prob 6) Write a function which returns every other element of the vector passed in. That is, it returns the all odd-...

2 years ago

Solved

Sum of elements of a vector (★★★)

Given any vector x = [x1, x2, x3, ... xn], compute the sum of its elements. Thus, if x = [ 1 3 -2 5 ], then the sum of its el...

2 years ago

Solved

Vector Multiplication

Vector Multiplication of three matrix as shown in test cases.

2 years ago

Solved

Variance computation (★)

Given a vector x with several values, compute the variance, whose formula is given by: <<https://i.imgur.com/Wg95KBE.gif>> ...

2 years ago

Solved

Create a vector of the first n natural numbers (★)

If n = 7, your program should return a vector y, where y = [1 2 3 4 5 6 7].

2 years ago

Solved

Average of corner elements of a matrix (★★)

(copy of prob 2235) Calculate the average of corner elements of a matrix. e.g. x=[1 2 3; 4 5 6; 7 8 9;] avg = (1+3+7+9)...

2 years ago

Solved

Vector raised to a power, element-wise (★)

Given a vector A and a number x, raise each element of the vector to the power of x. Thus, if A = [2 5 7 1] and x = 0.5, then ...

2 years ago

Solved

Generate n equally spaced "intervals" between -x and x (★)

Given n and x, return a list of numbers (in ascending order) that divides the interval [-x x] into n equal-length intervals. ...

2 years ago

Solved

Doubling elements in a vector (★★)

(copy of prob. 1024) Given the vector A, return B in which all numbers in A are doubling. So for: A = [ 1 5 8 ] t...

2 years ago

Solved

Element-wise vector product (★)

Given two vectors x and y, compute their element-wise product z. Thus, if x = [1 3 5] and y = [0.5 -1 2], then z = [1*0.5...

2 years ago