Azzera filtri
Azzera filtri

Conditional Plotting

2 visualizzazioni (ultimi 30 giorni)
old_user_rat
old_user_rat il 9 Apr 2012
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

Risposta accettata

Jonathan Sullivan
Jonathan Sullivan il 9 Apr 2012
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')

Più risposte (0)

Categorie

Scopri di più su Simulink Functions in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by