Matlab
2017-09-18 本文已影响0人
testfor
Matlab的数学计算=数值计算+符号计算
矩阵
矩阵生成
通过显式元素列表输入矩阵
通过语句生成矩阵
from:to
from:step:to
linspace(a,b,n)
logspace(a,b,n)
由矩阵生成函数产生特殊矩阵
zeros,ones,rand,eyes,
通过MAT数据文件加载
m(3,3)
子矩阵块的产生
a(1:3,2:3)
a(1:3,end)
clear
triu(X);%产生上三角阵
程序流程控制
for 循环变量=array
循环体
end
while 表达式
循环体
end
for i=1:1:30
display(i);
end
if i==1
elseif i==2
else
end
switch 开关表达式
case 表达式1
语句段1
case 表达式2
语句段2
otherwise
语句段n
end
try
语句段1
catch
语句段2
end
break,continue,return, pause, keyboard, input
绘图
plot(x,y,'*');%散点图
hold on;
figure;
subplot(221);
grid on;
plot(x,y,'x');
hold on;
plot(x,y,'*');
subplot(222);
imshow();
函数
全局变量
global X
function [sum,n]=Ex0514(x,y)
sum=x+y;