# 绘制一个正弦函数
>> t = [0:0.01:1];
>> y = sin(2*pi*4*t);
>> plot(t,y);
# 在上一个图像的基础上继续绘制
>> hold on;
>> z = cos(2*pi*4*t);
>> plot(t,z,'r');
# 添加轴标签
>> xlabel('time')
>> ylabel('value')
# 添加函数标签
>> legend('sin','cos')
# 添加图像标签
>> title('my plot')
# 将图像以png格式保存
>> print -dpng 'myPlot.png'
# 关闭图像
>> close
# 绘制不同图像
>> figure(1);
>> plot(t,y);
>> figure(2);
>> plot(t,z);
# 将画布一分为2,并使用第一部分绘制
>> subplot(1,2,1);
# 设置坐标轴刻度axis([x轴左边界 x轴右边界 y轴左边界 y轴右边界])
>> axis([0 1 -1 1])
# 清除图像
>> clf;
# 矩阵可视化
>> imagesc(A)
>> imagesc(A),colorbar,colormap gray;
网友评论