绘图
>> t=[0:0.01:0.98];
>> y1 = sin(2*pi*4*t);
>> plot(t,y1);
>> y2 = cos(2*pi*4*t);
>> plot(t, y1);
>> hold on; % hold on函数 的功能是将 新的图像绘制在 旧的之上>> plot(t, y2, 'r'); %r代表红色>> xlabel('time') %标记X轴即水平轴>> ylabel('value') >> legend('sin', 'cos') %用这个命令 legend('sin', 'cos') 将这个 图例放在右上方 表示这两条曲线表示的内容>> title('my plot')>> print -dpng 'myplot.png' %输出
>> close %最后关掉图片
>> figure(1); pl