how to plot the 3d graph

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 个评论

Please confirm that you want to plot within a MuPad notebook and not within MATLAB.
Have you seen the fplot family of functions in R2016a?

请先登录,再进行评论。

回答(1 个)

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