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,2,3];
Returns 1.
3ヶ月 前
解決済み
Swap the first and last columns
Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becomes the first. All oth...
3ヶ月 前
解決済み
Draw a 'Z'.
Given _n_ as input, generate a n-by-n matrix like 'Z' by _0_ and _1_ .
Example:
n=5
ans=
[1 1 1 1 1
0 0 0 1 ...
3ヶ月 前
解決済み
Draw a 'X'!
Given n as input Draw a 'X' in a n-by-n matrix.
example:
n=3
y=[1 0 1
0 1 0
1 0 1]
n=4
y=[1 0 0...
3ヶ月 前
解決済み
Draw 'O' !
Given n as input, generate a n-by-n matrix 'O' using 0 and 1 .
example:
n=4
ans=
[1 1 1 1
1 0 0 1
...
3ヶ月 前
解決済み
Draw a 'N'!
Given n as input, generate a n-by-n matrix 'N' using 0 and 1 .
Example:
n=5
ans=
[1 0 0 0 1
1 1 0 0 1
1 0 ...
3ヶ月 前
解決済み
Draw 'J'
Given n as input, generate a n-by-n matrix 'J' using 0 and 1 .
Example:
n=5
ans=
[0 0 0 0 1
0 0 0 0 1
0 0 ...
3ヶ月 前
解決済み
Draw 'I'
Given n as input, draw a n-by-n matrix 'I' using 0 and 1.
example:
n=3
ans=
[0 1 0
0 1 0
0 1 0]
n=...
3ヶ月 前
解決済み
Draw 'H'
Draw a x-by-x matrix 'H' using 1 and 0. (x is odd and bigger than 2)
Example:
x=5
ans=
[1 0 0 0 1
1 0 0 0 1
...
3ヶ月 前
解決済み
Draw 'F'
Draw a x-by-x matrix 'F' using 1 and 0. (x is odd and bigger than 4)
Example:
x=5
ans=
[1 1 1 1 1
1 0 0 0 0
...
3ヶ月 前
解決済み
Draw 'E'
Draw a x-by-x matrix 'E' using 1 and 0. (x is odd and bigger than 4)
Example:
x=5
ans=
[1 1 1 1 1
1 0 0 0 0
...
3ヶ月 前
解決済み
Draw 'D'.
Draw a x-by-x matrix 'D' using 0 and 1.
example:
x=4
ans=
[1 1 1 0
1 0 0 1
1 0 0 1
1 1 1 0]
3ヶ月 前
解決済み
Draw 'C'.
Given x as input, generate a x-by-x matrix 'C' using 0 and 1.
example:
x=4
ans=
[0 1 1 1
1 0 0 0
...
3ヶ月 前
解決済み
Draw 'B'
Draw a x-by-x matrix 'B' using 1 and 0. (x is odd and bigger than 4)
Example:
x=5
ans=
[1 1 1 1 0
1 0 0 0 1
...
3ヶ月 前
解決済み
Sum of series V
What is the sum of the following sequence:
Σk(k+1) for k=1...n
for different n?
3ヶ月 前
解決済み
Sum of series IV
What is the sum of the following sequence:
Σ(-1)^(k+1) (2k-1)^2 for k=1...n
for different n?
3ヶ月 前
解決済み
Sum of series III
What is the sum of the following sequence:
Σ(2k-1)^3 for k=1...n
for different n?
3ヶ月 前
解決済み
Sum of series II
What is the sum of the following sequence:
Σ(2k-1)^2 for k=1...n
for different n?
3ヶ月 前
解決済み
Sum of series I
What is the sum of the following sequence:
Σ(2k-1) for k=1...n
for different n?
3ヶ月 前
解決済み
Sum of series VII
What is the sum of the following sequence:
Σ(km^k)/(k+m)! for k=1...n
for different n and m?
3ヶ月 前
解決済み
Sum of series
a(n) = n^2 - (n-1)^2
find the summation of the series upto n i.e.
a(1)+a(2)+...+a(n)