Solved

Back to basics 22 - Rotate a matrix

Covering some basic topics I haven't seen elsewhere on Cody. Rotate the input matrix 90 degrees counterclockwise (e.g. [1 2; ...

circa 6 anni ago

Solved

Check if number exists in vector

Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

circa 6 anni ago

Solved

Return the first and last character of a string

Return the first and last character of a string, concatenated together. If there is only one character in the string, the functi...

circa 6 anni ago

Solved

Project Euler: Problem 1, Multiples of 3 and 5

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23...

circa 6 anni ago

Solved

Fahrenheit to Celsius using multiple statements

Given a Fahrenheit value F, convert to a Celsius value C. While the equation is C = 5/9 * (F - 32), as an exercise use two state...

circa 6 anni ago

Solved

Sum the elements in either diagonal of a square matrix

Sum the elements of a square matrix that lie on either the major diagonal or anti-diagonal.

circa 6 anni ago

Solved

Right and wrong

Given a vector of lengths [a b c], determines whether a triangle with those sides lengths is a right triangle: <http://en.wikipe...

circa 6 anni ago

Solved

Sum of diagonal of a square matrix

If x = [1 2 4; 3 4 5; 5 6 7] then y should be the sum of the diagonals of the matrix y = 1 + 4 + 7 = 12

circa 6 anni ago

Solved

Pizza value using expression with parentheses

Pizza prices are typically listed by diameter, rather than the more relevant feature of area. Compute a pizza's value (cost per ...

circa 6 anni ago

Solved

Create a row array using double colon operator

Create a row array from 9 to 1, using the double colon operator.

circa 6 anni ago

Solved

Transpose

Write a MATLAB script in order to convert a random length row vector (v) into a column vector.

circa 6 anni ago

Solved

Is it a number?

Determine if input is numeric. If it is,output is 1; if it is not, output is 0.

circa 6 anni ago

Solved

Maximum value in a matrix

Find the maximum value in the given matrix. For example, if A = [1 2 3; 4 7 8; 0 9 1]; then the answer is 9.

circa 6 anni ago

Solved

Mode

Find the mode of the vector Assumption: no vector is bimodal Example 1: input=[1 2 3 4 4]; output=4 Example 2: input=[7...

circa 6 anni ago

Solved

Back to basics 1 - Saving

Covering some basic topics I haven't seen elsewhere on Cody. Given an input variable 'x', save it to disk in a file named 'co...

circa 6 anni ago

Solved

Binary numbers

Given a positive, scalar integer n, create a (2^n)-by-n double-precision matrix containing the binary numbers from 0 through 2^n...

circa 6 anni ago

Solved

Let's get back to school, and create multiplication tables

For a given range, create multiplication tables. (start is always < endno) Example start = 17 endno = 19 Then, ...

circa 6 anni ago

Solved

Sum of diagonals elements of a matrix

Given a matrix, return the sum of all the elements across the diagonals. E.g. A = [1 2 3; 4 5 6; 7 8 9;...

circa 6 anni ago

Solved

Do Fast Fourier Transformation

Example Fast Fourier Transformation from vector [2,1]) ans = 3 1

circa 6 anni ago

Solved

Back to basics 6 - Column Vector

Covering some basic topics I haven't seen elsewhere on Cody. Given an input vector, output true or false whether it is a colu...

circa 6 anni 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...

circa 6 anni ago

Solved

Get the length of a given vector

Given a vector x, the output y should equal the length of x.

circa 6 anni ago

Solved

Back to basics 21 - Matrix replicating

Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, generate an output matrix that consists o...

circa 6 anni ago

Solved

radius of a spherical planet

you just measured its surface area, that is the input.

circa 6 anni ago

Solved

The Hitchhiker's Guide to MATLAB

Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

circa 6 anni ago

Solved

Back to basics 7 - Equal NaNs

Covering some basic topics I haven't seen elsewhere on Cody. Given 2 input variables, output true if they are equal, false ot...

circa 6 anni ago

Solved

Getting the indices from a vector

This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to <http://www.mathworks....

circa 6 anni ago

Solved

Determine Whether an array is empty

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

circa 6 anni ago

Solved

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

circa 6 anni ago