Sum of the Multiplication of Vectors
Given the vectors x and y as input, multiply the vectors and return the summation of its elements.
Example:
x = [1 2 ...
6年弱 前
解決済み
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
6年弱 前
解決済み
Alternating sum
Given vector x, calculate the alternating sum
y = x(1) - x(2) + x(3) - x(4) + ...
6年弱 前
解決済み
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]
...
Find my daddy long leg (No 's')
Given the ratio of the two legs (longer / shorter), and the hypotenuse length, find the value of the bigger leg.
6年弱 前
解決済み
Solve a System of Linear Equations
*Example*:
If a system of linear equations in _x₁_ and _x₂_ is:
2 _x₁_ + _x₂_ = 2
_x₁...
6年弱 前
解決済み
Max of a Vector
Write a function to return the max of a vector
6年弱 前
解決済み
Replace Vector Elements
Replace all elements in a vector which are equal to or smaller than zero with 0.1.
Example:
A = [1 2 3 -1 0 2 -3 -80];
...
6年弱 前
解決済み
Return the Fibonacci Sequence
Write a code which returns the Fibonacci Sequence such that the largest value in the sequence is less than the input integer N. ...
6年弱 前
解決済み
Problem for beginners
Suppose that x is a column vector, with at least a length of 6. Delete the 2., 6., and the second last row.
Example:
X=[1;2;3...
6年弱 前
解決済み
Mid-term report
You just got your mid-term report, but it's full of ones and twos :(. So before you give it to your parents, you change it, in o...
6年弱 前
解決済み
Simple Matrix
Make the following matrix without typing it in one by one.
[1 2 3;
2 4 6;
4 8 12]
x=[1 2 3].
6年弱 前
解決済み
Box
Give the volume of a box, x is equal to the body diagonal.