三,Mathematics
1. create matrices
magic(4), pascal(3), zeros(3,2), ones(5,5), randi(10,3,2) ...
[ ] putting vectors(rows, columns) together by using [ ]
2. matrices operations
A + B, A * B, A .* B,
A\' and A.\' are both transpose, for A containing complex numbers (a+bi), you have to also transpose complex numbers (a-bi) if A\', while A.\' does not.
Identity Matrix eye(m, n)
inv(A)
det(A)
cond(A)
norm(v, n), norm(A, n)
五,Programming
a = randi(100, 1)
if rem(a, 2) == 0
disp("even")
elseif a < 80
disp ...
else
disp ...
end
switch daystring
case \'monday\'
disp ...
case \'tuesday\'
disp ...
otherwise
disp ...
end
yournumber = input("enter a number:")
A == B returns where aij == bij, is a matrix too.
if isequal(A, B) returns a logical number 1 or 0
isempty
all
any
for n = 3 : 32
rn = rank(magic(n))
end
while
continue
break
请发表评论