首页 > 其他分享 >记录一个小错误

记录一个小错误

时间:2022-08-22 09:59:21浏览次数:39  
标签:11 plot Temperature 错误 title 一个 记录 Time axis

先看一个脚本:

x=1:6;
y=[1 5 3 9 11 8];
plot(x, y, 'r*');

%Change the axes and label them
axis([11 22 35 59])
xlabel('Time')
ylabel('Temperature')

%Put a title on the plot
title('Time and Temp')

修改后的脚本:

 1 x=1:6;
 2 y=[1 5 3 9 11 8];
 3 plot(x, y, 'r*');
 4 
 5 %Change the axes and label them
 6 axis([1 22 1 59])
 7 xlabel('Time')
 8 ylabel('Temperature')
 9 
10 %Put a title on the plot
11 title('Time and Temp')

看结果:

只是修改了第6行的代码,主要是函数axis中指定了x和y的上下限,选取不合理,自然不会有图出来了。

标签:11,plot,Temperature,错误,title,一个,记录,Time,axis
From: https://www.cnblogs.com/guochaoxxl/p/16611803.html

相关文章