how to plot the 3d graph

1 次查看(过去 30 天)
AKSHAYA RAUTA
AKSHAYA RAUTA 2016-2-9
回答: John BG 2016-3-7
dgh:= 0.09954;
Delta:=-0.68429;
sx:=-0.01098;
sy:= 0.05126;
Esup:=sx*x+sy*y+dgh*((x^2+y^2)/2+Delta*(x^2-y^2)/2)^(1/2);
Einf:=sx*x+sy*y-dgh*((x^2+y^2)/2+Delta*(x^2-y^2)/2)^(1/2);
how to plot the graphs of the two functions in the same plot.
  2 个评论
Walter Roberson
Walter Roberson 2016-2-9
Please confirm that you want to plot within a MuPad notebook and not within MATLAB.
Sarah Palfreyman
Sarah Palfreyman 2016-3-7
Have you seen the fplot family of functions in R2016a?

请先登录,再进行评论。

回答(1 个)

John BG
John BG 2016-3-7
Hi Akshaya
the straight way to visualize the function boundaries is, for Esup
dgh= 0.09954;
Delta=-0.68429;
sx=-0.01098;
sy= 0.05126;
x=[-20:1:20];y=[-20:1:20]
[X,Y]=meshgrid(x,y)
Esup=sx*X+sy*Y+dgh*(abs((X.^2+Y.^2)/2+Delta*(X.^2-Y.^2)/2)).^.5
figure(1);surf(X,Y,Esup)
and Einf:
figure(2);surf(X,Y,Einf)
I had to add the abs() otherwise the boundaries showed complex values when attempting to solve sqrt of negative values.
To plot both boundaries in same graph use command hold:
figure(1);hold all;surf(X,Y,Einf)
If you find this answer of any help solving your question, please click on the thumbs-up vote link,
thanks in advance
John

标签

Community Treasure Hunt

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

Start Hunting!

Translated by