Solved

"mirror" matrix

Create n x 2n "mirror" matrix of this type: e.g. for n = 2 m = [1 2 2 1;1 2 2 1] e.g. for n = 3 m = [1 2 3 3 2 1...

3 years ago

Solved

De-dupe

Remove all the redundant elements in a vector, but keep the first occurrence of each value in its original location. So if a =...

3 years ago

Solved

Calculate the number of elements in a matrix.

Calculate the number of elements in a matrix.

3 years ago

Solved

Odd times 3

Given a input matrix x, multiply all odd values by 3. Even values remain the same. example: x = [1 2 3 4 5;... 6 7...

3 years ago

Solved

A shooting competition

In a shooting competition, the target is a square of side L containing a circle of radius R<=L/2. A player scores one point if h...

3 years ago

Solved

Circular Shift Me

Given a vector v=[1 3 6 9 11], circular shift them while iterating m=[1 3 6 9 11; 11 1 3 6 9; 9 11 1 3 6; 6 9 11 1 3; 3 6 9 1...

3 years ago

Solved

Create cell array of strings

Convert the input to a cell array, but only if necessary. If the input is a string, return a 1-by-1 cell array containing the...

3 years ago

Solved

I told you not separate me, but you did :( - ACDC

Given input vector, output it's DC and AC value Example: input = 0 1 -1 0 ac = 0 1 -1 0 dc = 0

3 years ago

Solved

Performance - summation

Given a vector of natural numbers x = [1,2,3,...,N] compute the sum of its elements by not stressing the machine too much...

3 years ago

Solved

All odd - all even

All odd numbers in x are added, while all even numers are subtracted from this. example: x = [1 2 3 4 5]; y = +(1+3+5)-...

3 years ago

Solved

Flipping a Matrix

Flipping matrix up and down. If a central row is exists, leave it, and flip remaining rows. Example Mat = magic(3) ...

3 years ago

Solved

Can I make a right triangle ?

Input(a) - is vector with any amount of values. Interpreted as legths of sides. Output(b): * Is true if there are any 3 va...

3 years ago

Solved

Print true if

all elements are larger than 5 a=[1 3 5 8 6]; b=[6 6 6 6 6]; function(a) should be false, and function(b) will be tru...

3 years ago

Solved

Convert Kilometers to Miles

Convert kilometers to miles. Consider 1 km = 0.62 mile. Note: Don't use the '*' operator.

3 years ago

Solved

Sum positive elements of matrix.

Calculate sum of positive elements of the matrix.

3 years ago

Solved

Pointwise multiplication of vectors.

Pointwise multiplication of vectors x and y. Example x= [1 3 5 7 9 11 13 15 17 19] y=[ 1 4...

3 years ago

Solved

Annoying population

Every year the number of annoying persons in the office triples Found the population, given a(0) and t

3 years ago

Solved

"Power matrix" of two vectors

Given two row vectors x,y of lengths m and n (respectively), create an m x n matrix whose i,j entry is x(i)^y(j).

3 years ago

Solved

Find the definite integral of various linear functions

A definite integral had a minimum and maximum limit. When you solve this type of problem you must use both quad and the trapz fu...

3 years ago

Solved

Calculate the centroid of a triangle

Info: https://en.wikipedia.org/wiki/Centroid Example Input: x = [0 0 1]; % x-coordinate y = [0 1 0]; % y-coordinat...

3 years ago

Solved

Combinations without using nchoosek

You have to generate a matrix with all possible combinations of n elements *taken 2* at a time, *without using nchoosek(1:n,2)* ...

3 years ago

Solved

Polynomial Evaluation

Create a routine that takes a list of coefficients of a polynomial in order of increasing powers of x; together with a value of ...

3 years ago