Commands for plot and subplot
68 次查看(过去 30 天)
显示 更早的评论
Examine the code given below in MATLAB: subplot(3,1,1); plot(t,x); subplot(3,1,2); plot(t,y); subplot(3,1,3); plot (t,z); What is the output of the above code? What do subplot and plot commands do?
0 个评论
采纳的回答
Arif Hoq
2022-1-27
编辑:Arif Hoq
2022-1-27
Subplot: Subplot divides the current figure into row,column and the figure position.
Plot: plot creates a 2 dimension(X axes vs Y axes) figure or line plot
please check this example:
t= 0:pi/100:2*pi;
x=sin(t);
y=cos(t);
z=x+y;
figure(1)
subplot(3,1,1) % means divided into 3 row, 1 column and creats into position 1
plot(t,x) % a=X values and X is you expected output or Y axes value
subplot(3,1,2) % means divided into 3 row, 1 column and creats into position 2
plot(t,y)
subplot(3,1,3) % means divided into 3 row, 1 column and creats into position 3
plot(t,z)
if you want more please type in the command prompt:
doc plot
doc subplot
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!