Solved

Basic commands - Least common multiple

Make a function which will return least common multiple of "a" and "b" Example: a=8; b=6; y=24;

3 years ago

Solved

Union of two set decreasing order

Union of two set decreasing order Say, x=[1 2 5] and y=[5 7 8] then answer must be [8 7 5 2 1]

3 years ago

Solved

Decide whether determinant is zero.

Given a 3 x 3 matrix, find the determinant. Let y = true if the determinant is zero, and let y = false if the determinant is no...

3 years ago

Solved

Create an anti-identity matrix

Create an anti-identity matrix of given dimension. Examples n = 2 A = [0 1; 1 0] n = 3 A = [0 0 1; 0 1 0; 1 0 0...

3 years ago

Solved

Matlab Basics II - Extract last 3 elements of a vector

Let x be a vector of unknown length, we are always interested in the last 3 numbers in the vector, write a function that gives t...

3 years ago

Solved

Get 1-4-3-4-4

Get the value of the indices in the title and assign it to an array

3 years ago

Solved

Rounding off numbers to n decimals

Inspired by a mistake in one of the problems I created, I created this problem where you have to round off a floating point numb...

3 years ago

Solved

Matlab Basics II - Log and natural log

Write a function that calculates the difference between the log and natural log of a vector, to two decimal places example: ...

3 years ago

Solved

Remove All elements less than 5

Given an input vector x, remove all elements of x less than 5 . Example: Input x = [ 1 2 5 7 3 ] Output y is [ 5 7 ...

3 years ago

Solved

Sort complex numbers into complex conjugate pairs

Sort complex numbers into complex conjugate pairs. Example: Input x = [3-6i -1-4i -1+4i 3+6i] Sorted output = [-1 - ...

3 years ago

Solved

Find out value of sine given by degree.

Find out value of sine given by degree. If theta=30, it's value must be 0.5.

3 years ago

Solved

Element by element multiplication of two vectors

Given two input vectors, return the element-by-element product. Example A = [1 2 3] B = [7 3 1] The answer should be...

3 years ago

Solved

Matlab Basics II - Unit Conversion

Write a function that converts Kg to lbs, returns the answer to the nearest 1/100th of a pound

3 years ago

Solved

Help the Patriots get to the Super Bowl

Given a football by the Patriots, return it to them with 2 psi less air in it. (The original psi is passed as a number to the...

3 years ago

Solved

Duplicate each element of a vector.

for an n-dimensional vector x, the function should return another vector 2n-dimension which each element is repeated twice. Ex...

3 years ago

Solved

Evaluate Polynomial

Given a polynomial equation coefficients in a vector p, you have to return its value at x. Example: For inputs p and x ...

3 years ago

Solved

Append two matrix as shown below example

Append two matrix as shown below example A=[1 2; 3 4] and B=[5 6;7 8] Answer must be 1 2 5 6 3...

3 years ago

Solved

Square the input

Given a scalar or vector x, return the square of each element. Example x = [7 2] answer = [49 4]

3 years ago

Solved

chance in percent for minimum K heads when a good coin is tossed N times?

For example, chance is 100% for minimum 0 heads when a coin is tossed 7 times. Chance is 50% for minimum 2 heads when a coin is...

3 years ago

Solved

Identify the heavier bag

There are N=2^n bags of rice looking alike, N-1 of which have equal weight and one is slightly heavier. The weighing balance is ...

3 years ago

Solved

Local Minima

Given a vector of data x, find the values of local minimum that is smaller than its neighbor elements. For example, if x =...

3 years ago

Solved

Modify an array's elements

Write a for loop that iterates from 1 to numberSamples to double any element's value in dataSamples that is less than minValue. ...

3 years ago

Solved

Cannon Ball

Given g (acceleration due to gravity) and desired altitude x, find the minimum ground velocity of a cannon ball to reach x.

3 years ago

Solved

Max Change in Consecutive Elements

If an array is given as input then find the index of consecutive elements that represent maximum change. Example: Input ...

3 years ago

Solved

Change number representation to HEX

Given a number change it's representation to HEX and output it.

3 years ago

Solved

Moore-Penrose pseudoinverse of matrix

Find the command for Moore-Penrose pseudoinverse of matrix and solve

3 years ago