Solved

Speed of car

Calculate the Speed of car given its Distance travelled and time taken in x and y respectively

5 months ago

Solved

Sort a list of complex numbers based on far they are from the origin.

Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...

5 months ago

Solved

Matlab Basics II - Intervals

Write a function that takes an interval from a to b, and divides it into 5 parts example: a = 1, b = 2 output = 1 1.25 ...

5 months ago

Solved

Finding perimeter of a rectangle

A rectangle has a length of x centimeters and a width of w centimeters. Find the perimeter.

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

5 months ago

Solved

Create matrix of replicated elements

Given an input element x, and the dimensions, (m, n) return a matrix of size m x n filled with element x. Example: Input: ...

5 months ago

Solved

Back to basics 15 - Benchmark

Covering some basic topics I haven't seen elsewhere on Cody. Return an array of the benchmark values for MATLAB.

5 months ago

Solved

Create a two dimensional zero matrix

You have to create a zero matrix of size (mxn) whose inputs are m and n and the elements of your matrix should be zeros. Exam...

5 months ago

Solved

Matlab Basics - Convert a row vector to a column vector

Write a script to convert a row (e.g. x = [1 2 3]) to a column (e.g. y = [1;2;3]), your script should be able to do this for any...

5 months ago

Solved

Create a vector whose elements depend on the previous element

The idea is to create a vector A whose elements depend on the previous element : *A(i+1) = 2*A(i)+1* *2 Inputs*: - A : The...

5 months ago

Solved

Replace multiples of 5 with NaN

It is required to replace all values in a vector that are multiples of 5 with NaN. Example: input: x = [1 2 5 12 10 7] ...

5 months ago

Solved

03 - Matrix Variables 1

Make the following variable: <<http://samle.dk/STTBDP/Assignment1_3a.png>> A 9x9 matrix full of 2's (Hint: use *ones* o...

5 months ago

Solved

Convert a vector into a number

This is a sub problem related to this problem: <http://www.mathworks.com/matlabcentral/cody/problems/621-cryptomath-addition>...

5 months ago

Solved

Make a run-length companion vector

Given a vector x, return a vector r that indicates the run length of any value in x. Each element in r shows how many times the ...

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

5 months ago

Solved

Number of Horns on a unicorn!

Calculate the number of horns on a *unicorn*! And I'm talking about a unicorn with not more than one horn on it!

5 months ago

Solved

Compute a dot product of two vectors x and y

x and y are input vectors, d is a number and contains their dot product

5 months ago

Solved

Back to basics 8 - Matrix Diagonals

Covering some basic topics I haven't seen elsewhere on Cody. Given an input vector of numbers, output a square array with the...

6 months ago

Solved

Sorted highest to lowest?

Return 1 if the input is sorted from highest to lowest, 0 if not. Example: 1:7 -> 0 [7 5 2] -> 1

6 months ago

Solved

Is this triangle right-angled?

Given three positive numbers a, b, c, where c is the largest number, return *true* if the triangle with sides a, b and c is righ...

6 months ago

Solved

Making change

Given an amount of currency, return a vector of this form: [100 50 20 10 5 2 1 0.5 0.25 0.1 0.05 0.01] Example: Input a = ...

6 months ago

Solved

How to find the position of an element in a vector without using the find function

Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

6 months ago

Solved

Which doors are open?

There are n doors in an alley. Initially they are all shut. You have been tasked to go down the alley n times, and open/shut the...

6 months ago

Solved

Calculate area of sector

A=function(r,seta) r is radius of sector, seta is angle of sector, and A is its area. Area of sector A is defined as 0.5*(r^2...

6 months ago

Solved

Number of 1s in a binary string

Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

6 months ago