How to Plot a graph with restriction?

조회 수: 31 (최근 30일)
Mustahsan Majeed
Mustahsan Majeed 2014년 9월 15일
댓글: Mischa Kim 2014년 9월 18일
Hi,
I am sorry I am new to MATLAB and dont know how to exactly formulate my quetsion.
I want to plot a graph between two variables but I want to restrict the plot area with a third varible. For example:
x = (0.5*pi:0.1:6*pi) y = sin(x)
Plot (x,y)
but now i want to restrict my plot with the following variable:
z = (pi:0.1;2*pi)
Note: The divisions are same for 'x' and 'z'.
Thanks, Mustahsan

채택된 답변

Mischa Kim
Mischa Kim 2014년 9월 15일
Mustahsan, what do you mean by restrict? Setting the plotting limits? Something like:
xlim([pi, 2*pi])
  댓글 수: 5
Mustahsan Majeed
Mustahsan Majeed 2014년 9월 16일
All the three variables are attached with this reply. All three have same number of rows but I only want to plot 'n' against 'M_ISO' using only those rows where 'POS_thr' is between 95 to 100.
Mischa Kim
Mischa Kim 2014년 9월 18일
Use
plot(n(POS_thr>=95 & POS_thr<=100), M_ISO(POS_thr>=95 & POS_thr<=100),'or');

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

추가 답변 (1개)

Michael Haderlein
Michael Haderlein 2014년 9월 15일
Dear Mustahsan,
not sure if that's what you mean, but please check for
xlim([pi 2*pi])
Best regards, Michael

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by