Alternating sum
Given vector x, calculate the alternating sum
y = x(1) - x(2) + x(3) - x(4) + ...
6ヶ月 前
解決済み
Create an index-powered vector
Given a input vector x, return y as index-powered vector as shown below.
Example
x = [2 3 6 9]
then y should be
[...
6ヶ月 前
解決済み
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...
6ヶ月 前
解決済み
Area of a Square
Inside a square is a circle with radius r.
What is the area of the square?
6ヶ月 前
解決済み
Square a Number
Given an input x, return y, which is equal to the square of x.
Gif animations with Matlab
I just wanted here to share a link to some .gif animations I created over the years with Matlab :-)
Wikimedia : uploads by Ni...
Set some matrix elements to zero
First get the maximum of each *row*, and afterwards set all the other elements to zero. For example, this matrix:
1 2 3 ...