필터 지우기
필터 지우기

Conditional Plotting

조회 수: 2 (최근 30일)
old_user_rat
old_user_rat 2012년 4월 9일
Hi all,
I would like to plot the following graph only for the range where y2=>y1, leaving Z for y1>y2 empty.
y1=0:0.01:1;
y2=0:0.01:1;
[Y1,Y2]=meshgrid(y1,y2);
Z=((Y1 - Y2).*(Y1.^2 + 4*Y1.*Y2 - 6*Y1 + 7*Y2.^2 - 18*Y2 + 12))/12;
surf(Y1,Y2,Z)
xlabel('Y1')
ylabel('Y2')
How can I do this? Many thanks for any help. David

채택된 답변

Jonathan Sullivan
Jonathan Sullivan 2012년 4월 9일
y1=0:0.01:1;
y2=0:0.01:1;
[Y1,Y2]=meshgrid(y1,y2);
Z=((Y1 - Y2).*(Y1.^2 + 4*Y1.*Y2 - 6*Y1 + 7*Y2.^2 - 18*Y2 + 12))/12;
Z(Y1 > Y2) = NaN;
surf(Y1,Y2,Z)
xlabel('Y1')
ylabel('Y2')
  댓글 수: 1
old_user_rat
old_user_rat 2012년 4월 9일
Great, thanks

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by