Risolto

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 (...

circa 2 anni fa

Risolto

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 ...

circa 2 anni fa

Risolto

execute the declaration in strings and return value

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

circa 2 anni fa

Risolto

Alternately upper-lower case

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

circa 2 anni fa

Risolto

interesting center of magic matrix

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

circa 2 anni fa

Risolto

most frequent character

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

circa 2 anni fa

Risolto

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 = ...

circa 2 anni fa

Risolto

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...

circa 2 anni fa

Risolto

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] ...

circa 2 anni fa

Risolto

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 ...

circa 2 anni fa

Risolto

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

circa 2 anni fa

Risolto

Determine the length of a string of characters

Determine the length of a string of characters

circa 2 anni fa

Risolto

Matrix multiplication

Multiply two incoming matrices via matrix multiplication

circa 2 anni fa

Risolto

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-...

circa 2 anni fa

Risolto

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...

circa 2 anni fa

Risolto

Vector Multiplication

Vector Multiplication of three matrix as shown in test cases.

circa 2 anni fa

Risolto

Variance computation (★)

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

circa 2 anni fa

Risolto

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].

circa 2 anni fa

Risolto

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)...

circa 2 anni fa

Risolto

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 ...

circa 2 anni fa

Risolto

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. ...

circa 2 anni fa

Risolto

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...

circa 2 anni fa

Risolto

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...

circa 2 anni fa