c/c++语言开发共享matlab 和octave笔画之如何画图表 plot()函数的简单介绍

画图命令plot(x,y)例子:>> t = [0:0.2:15];>> y = sin(pi*t);>> plot(t,y)>>图片在图表上再画一条线>> hold on;>> y2 = cos(pi*t)>> plot(t, y2, ‘r’) %’r’ rea line添加xy轴标签, 标题和每天线的解释(legend)>> xlabel(‘time’)>&.

  • 画图命令plot(x,y)
    例子:
>> t = [0:0.2:15]; >> y = sin(pi*t); >> plot(t,y) >> 

图片
matlab 和octave笔画之如何画图表 plot()函数的简单介绍

  • 在图表上再画一条线
>> hold on; >> y2 = cos(pi*t) >> plot(t, y2, 'r') %'r' rea line  
  • 添加xy轴标签, 标题和每天线的解释(legend)
>> xlabel('time') >> ylabel('speed') >> title('graph') >> legend('sin','cos')  

最终图片
matlab 和octave笔画之如何画图表 plot()函数的简单介绍

  • 存储图表
  • cd 'path'; print -dpng ;myPlot.png
  • 关闭窗口
  • close
  • 创建一个窗口并再上面画两个图
figure(1) subplot(1,2,1) % 把一个窗口分成两个表,使用第一个表 plot(t, y1) subplot(1,2,2) %使用第二个表 axis[0 1 -1 1] %标记x和y的范围 

c/c++开发分享matlab 和octave笔画之如何画图表 plot()函数的简单介绍地址:https://blog.csdn.net/wchasedream/article/details/107489330

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/c-cdevelopment/598582.html

(0)
上一篇 2021年5月8日
下一篇 2021年5月8日

精彩推荐