Help plotting equations in 3D
Show older comments
I am looking to plot the following in MATLAB to create a figure similar to the picture attached.

The equations are:
x=a*cos(phi);
y=a*sin(phi);
z=sqrt((c.^2./(r-(x.^2 + y.^2))).*(r-((1+epsilon).*(x.^2 + y.^2))));
where r=(a-A.*((y.^2.*(3.*x.^2-y.^2))./(x.^2+y.^2)).^B).^2;
And constants are:
a=1;
A=0.1339;
B=0.397;
c=1;
phi=0:0.001:2*pi;
epsilon=10.^-5;
NOTE: The original z equation is attached (I just solved for z and made a variable r to save space):

I have tried using plot3(X,Y,Z) using
[X,Y]=meshgrid(x,y);
z=peaks(6284);
because I found something similar in another tread.
The result is:

I appreciate any help you can offer!
2 Comments
Star Strider
on 25 Aug 2015
The plot3 function requires three column vectors for its arguments. It doesn’t use meshgrid.
It will help if you post your code, or attach it if it is longer than about 20 lines. (Use the ‘paperclip’ icon and complete both steps.)
Walter Roberson
on 25 Aug 2015
plot3() does accept meshgrid arguments.
Accepted Answer
More Answers (0)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
