Commands for plot and subplot

22 visualizaciones (últimos 30 días)
Nidhi Nagar
Nidhi Nagar el 27 de En. de 2022
Comentada: Nidhi Nagar el 27 de En. de 2022
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?

Respuesta aceptada

Arif Hoq
Arif Hoq el 27 de En. de 2022
Editada: Arif Hoq el 27 de En. de 2022
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

Más respuestas (0)

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by