PDRA at Univ of Cambridge

Solved

replace empty matrices with '[]'

for example a=1;a(:,1)=[]; returns a = Empty matrix: 1-by-0 use this as the input,and the output should be '[]...

4 years ago

Solved

Data Regularization

Provided is an m-by-n integer data matrix A whose elements are drawn arbitrarily from a set *S* = [1,2,3,...,S] for any large in...

4 years ago

Solved

Can't wait for NewYear ball drop !

Given an input string of the form 'yyyy-mm-dd' or 'yyyy-mm-dd hh:mm:ss', return a string message indicating how many days, hours...

4 years ago

Solved

Find the 9's Complement

Find the 9's complement of the given number. An example of how this works is <http://electrical4u.com/9s-complement-and-10s-c...

4 years ago

Solved

Matrix Construction I

Given n, construct a matrix as shown in the example below. Example For n=8, the output should look like this: 1 2 3 4 ...

5 years ago

Solved

Special matrix

Make a square matrix with this shape. For n=4 M = 1 1 0 0 1 0 1 0 0 1 0 ...

5 years ago

Solved

Roots

Find out the roots of a given polynomial equation.Given are the coefficients of the equation.

5 years ago

Solved

Detect a number and replace with two NaN's

Write code which replaces the number 1 with two NaNs. Example X = [ 1 2 NaN 4 1 3 7 NaN 1 4 NaN 2] ...

5 years ago

Solved

Function definition: Double down.

* Complete the DoubleDown function to return twice the initialValue.

5 years ago

Solved

Number of Circles in a Number

Given a number, return the number of closed 'circles' in the base 10 numerical representation. Note: the number 4 has no circ...

5 years ago

Solved

Try and Catch Simple Example

Try and Catch Simple Example <http://in.mathworks.com/help/matlab/ref/try.html Example> Vector x=[1 4 6 8 10]; Create...

5 years ago

Solved

Distance walked 1D

Suppose you go from position 7 to 10 to 6 to 4. Then you have walked 9 units of distance, since 7 to 10 is 3 units, 10 to 6 is 4...

5 years ago

Solved

Triple function composition

Given three functions f,g and h, create the composed function y=f(g(h)). Example f = @(x) x+1 g = @(x) x/2 h = @(x) ...

5 years ago

Solved

Split up vector or matrix delimited by NaNs

Given several vectors contained within one vector delimited by NaNs, return each individual vector as an element of a cell vecto...

5 years ago

Solved

Back to basics 14 - Keywords

Covering some basic topics I haven't seen elsewhere on Cody. Return a cell array of all MATLAB keywords

5 years ago

Solved

Stress-Strain Properties - 2

The resilience of a material is its ability to resist permanent (or plastic) deformation. The resilience coincides with the elas...

5 years ago

Solved

Stress-Strain Properties - 1

This is the first in a series of problems regarding mechanics of materials, in particular, material properties drawn from stress...

5 years ago

Solved

Back to basics 9 - Indexed References

Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix and row and column, output the index of th...

5 years ago

Solved

Index one element in each vector of an array along a given dimension

Functions like min and max can return in their second output argument the index of the element in each vector along a particular...

5 years ago

Solved

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

5 years ago

Solved

It dseon't mettar waht oedrr the lrettes in a wrod are.

An internet meme from 2003 (read more <http://www.snopes.com/language/apocryph/cambridge.asp here>) asserted that readers are re...

5 years ago

Solved

Arrange vector in ascending order

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

5 years ago

Solved

So many choices

For inputs _n_ and _k_ (in that order), output the number of ways that k objects can be chosen from amongst n distinct objects. ...

5 years ago

Solved

Put m balls into n boxes (again)

According to <http://www.mathworks.com/matlabcentral/cody/problems/1516-put-m-balls-into-n-boxes Cody Problem 1516>, if I put 3 ...

5 years ago

Solved

Find the maximum two numbers of every column of a matrix

Find the maximum two numbers of every column of a matrix. Example: If we input a matrix A = [ 1 2 4 6 0 3 ...

5 years ago

Solved

Add two numbers

Calculate the sum of two numbers. Example input = [2 3] output = 5

5 years ago

Solved

Rotate a Matrix

Input a Matrix x, Output y is the matrix rotating x 90 degrees clockwise

5 years ago

Solved

Whether the input is vector?

Given the input x, return 1 if x is vector or else 0.

5 years ago