Remove NaNs and numbers adjacent to NaNs
The aim is to remove the elements before and after NaN occurrences inside a vector.
For example:
x = [6 10 5 8 9 NaN 23 1...
Find the Area of a Polygon
Consider 2-D geometry and assume that the points are given in form of rows of a matrix. Find the area of polygon enclosed by the...
2 years 前
已解决
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]
2 years 前
已解决
Is A the inverse of B?
Given a matrix A and a matrix B, is A the inverse of B?
>>A=[2,4;3,5];
>>B=[-2.5,2;1.5,-1];
>>isInverse...
2 years 前
已解决
Function composition
Write a function that accepts two function handles f and g and returns the composition h. That is,
h = (f o g)(x) = f(g(x))
...
2 years 前
已解决
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
...