필터 지우기
필터 지우기

Commands for plot and subplot

조회 수: 28 (최근 30일)
Nidhi Nagar
Nidhi Nagar 2022년 1월 27일
댓글: Nidhi Nagar 2022년 1월 27일
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?

채택된 답변

Arif Hoq
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
  댓글 수: 1
Nidhi Nagar
Nidhi Nagar 2022년 1월 27일
Got it, Thank you so much..!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by