해결됨

Back to basics 12 - Input Arguments

Covering some basic topics I haven't seen elsewhere on Cody. Return a value equal to the number of input arguments to the fun...

13일 전

해결됨

02 - Vector Variables 3

Make the following variable: <<http://samle.dk/STTBDP/Assignment1_2c.png>> (all the numbers from 5 to -5 in increments of ...

13일 전

해결됨

Omit columns averages from a matrix

Omit columns averages from a matrix. For example: A = 16 2 3 13 5 11 10 8 9 7 ...

13일 전

해결됨

Back to basics 10 - Max Float

Covering some basic topics I haven't seen elsewhere on Cody. Return the largest positive floating-point number MATLAB can han...

13일 전

해결됨

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

13일 전

해결됨

Flag largest magnitude swings as they occur

You have a phenomenon that produces strictly positive or negative results. delta = [1 -3 4 2 -1 6 -2 -7]; Marching thr...

13일 전

해결됨

Find a subset that divides the vector into equal halves

Given a vector x, return the indices to elements that will sum to exactly half of the sum of all elements. Example: Inpu...

13일 전

해결됨

Solitaire Cipher

Implement the <http://en.wikipedia.org/wiki/Solitaire_(cipher) solitaire cipher>. Since this is from Wikipedia, I am capturin...

13일 전

해결됨

How long is the longest prime diagonal?

Stanislaw Ulam once observed that if the counting numbers are <http://en.wikipedia.org/wiki/Ulam_spiral arranged in a spiral>, t...

15일 전

해결됨

Find the biggest empty box

You are given a matrix that contains only ones and zeros. Think of the ones as columns in an otherwise empty floor plan. You wan...

16일 전

해결됨

Spot the outlier

All points except for one lie on a line. Which one is the outlier? Example: You are given a list of x-y pairs in a column ...

16일 전

해결됨

Find the nearest prime number

Happy 5th birthday, Cody! Since 5 is a prime number, let's have some fun looking for other prime numbers. Given a positive in...

20일 전

해결됨

Draw a 'N'!

Given n as input, generate a n-by-n matrix 'N' using 0 and 1 . Example: n=5 ans= [1 0 0 0 1 1 1 0 0 1 1 0 ...

20일 전

해결됨

Draw 'E'

Draw a x-by-x matrix 'E' using 1 and 0. (x is odd and bigger than 4) Example: x=5 ans= [1 1 1 1 1 1 0 0 0 0 ...

20일 전

해결됨

Remove the first, third and fifth rows of a matrix

Given a matrix x with at least five rows, return a matrix y that includes all rows of x except for th 1st, the 3rd and 5th. E...

20일 전

해결됨

Flip the main diagonal of a matrix

Given a n x n matrix, M, flip its main diagonal. Example: >> M=magic(5); >> flipDiagonal(M) 9 24 1 ...

20일 전

해결됨

How many trades represent all the profit?

Given a list of results from trades made: [1 3 -4 2 -1 2 3] We can add them up to see this series of trades made a profit ...

20일 전

해결됨

Draw 'J'

Given n as input, generate a n-by-n matrix 'J' using 0 and 1 . Example: n=5 ans= [0 0 0 0 1 0 0 0 0 1 0 0 ...

20일 전

해결됨

Write a function man that takes a row vector v and returns a matrix H as follows..

Write a function called man that takes a row vector v as an input and returns a matrix H whose first column consist of the eleme...

20일 전

해결됨

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

20일 전

해결됨

Angle between two vectors

You have two vectors , determine the angle between these two vectors For example: u = [0 0 1]; v = [1 0 0]; The a...

20일 전

해결됨

Sum of adjacent elements in a vector

Given a vector v, return a vector s containting the sum of every two adjacent elements in the vector. Every element s(i) cont...

20일 전

해결됨

Back to basics 23 - Triangular matrix

Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, return a matrix with all elements above a...

20일 전

해결됨

Extra safe primes

Did you know that the number 5 is the first safe prime? A safe prime is a prime number that can be expressed as 2p+1, where p is...

20일 전

해결됨

Determine Whether an array is empty

Input a matrix x, output y is TRUE if x is empty, otherwise FALSE.

21일 전

해결됨

Try 1.5.4: Celsius to Fahrenheit

Write a program to convert an input given in Celsius to Fahrenheit. Examples: Input celsiusValue = 100 Output fahrValu...

21일 전

해결됨

multiply by three

Given the variable x as your input, multiply it by 3 and put the result equal to y. Examples: Input x = 2 Output y is ...

21일 전

해결됨

Multiply a column by a row

* Given a column vector C and and a row vector R. * Output a matrix M. * Every column of M equals to C multiplied by correspon...

21일 전

해결됨

Arrange vector in ascending order

Arrange a given vector in ascending order. input = [4 5 1 2 9]; output = [1 2 4 5 9];

21일 전