matlab多久入门 MATLAB绘图操作实验报告

简单绘图
x=1:0.1:2*pi;
y=sin(x);
xlabel('x轴');x轴上显示
ylabel('y轴');y轴上显示
plot(x,y);输出图像
grid on/off;显示xy轴上的网格
hold on显示多个函数
plot(x,y1,x,y2)显示两个函数
legend('','')按函数顺序显示图例
绘图属性控制
axis(m n x y)xy轴大小
默认axis auto
axis equal图形在一个正方形内
对数函数
x=10.^(0:0.1:10);
y=0:0.1:10;
【matlab多久入门 MATLAB绘图操作实验报告】 plot(x,y);
semilogx(x,y);以10的次方为x轴
loglog(x,y);对xy同时取对数
输入输出函数
input()输入
fprintf()/disp输出
ischar()是否字符串
isnumeric()是否数值
isempty()是否为空
isinf()是否无穷大
isnan()不确定
if语句
if
elseif
else
end
if嵌套
if
else
if
else
end
end
switch结构
switch()
case{},
case{},
otherwise;
end
try /catch结构
try
语句块
catch
语句块
end
窗口
figure()绘图窗口
subplot(m,n,p)创建m乘n个窗口第P个窗口绘图
axis square方形窗口
极坐标图
polar(x,y)