Plotting equation of two variables

Hi, I'd appreciate some guidance/assistance plotting: y = -sin^3(theta); x = cos^3(theta) All my attempts have produced graphs slightly different than the desired result (see attachment for my graph of reference=desired result). Could it be that the desired result (my graph of reference) was created trying to plot the equation (its solutions rather) y^2/3 + x^2/3 == 1? Mathematically it appears to be similar yet could it have produced a result somewhat different?

回答(1 个)

theta = linspace(0,2*pi) ;
y = -sin(theta).^3;
x = cos(theta).^3 ;
plot(x,y)

3 个评论

Yuval
Yuval 2017-1-23
编辑:Yuval 2017-1-23
As you can judge from the attached plot, the results don't match. I am trying to plot: (2*alpha*x) = Y = -(sin(theta))^3; (2*alpha*z) = X = cos(theta)^3 It could be that the attached plot is actually the plot for the set of solutions of (2*alpha*x)^2/3 + (2*alpha*z)^2/3 = 1, but mathematically I don't see why simply plotting -(sin(theta))^3 as a function of (cos(theta))^3 shouldn't be similar. I'd really appreciate some help sorting this out.
I don't think the result is different......to get the plot shown in the image, you need to restrict the values of theta. Use axis([0 1 -1 1]) after plotting using the above code.
I have tried that and the curve seems different. Whereas the plot shown in the image converges to zero at (2alpha*z)=~0.7, the plot your code produces only converges to zero at (2alpha*z)=~1. You see, the slope of the curve seems to be different. How may I fix this?

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 2-D and 3-D Plots 的更多信息

提问:

2017-1-23

评论:

2017-1-23

Community Treasure Hunt

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

Start Hunting!

Translated by