MATLAB Answers

How do I plot this curve?

25 views (last 30 days)
Dan
Dan on 29 Jan 2021
Answered: VBBV on 30 Jan 2021
y(1+0.5y) = x^2
where x = [-pi, pi]
Do I use fsolve? Is there an easier method? Appreciate any help

Answers (2)

John D'Errico
John D'Errico on 29 Jan 2021
Edited: John D'Errico on 29 Jan 2021
Why would you think you need to use fsolve? Even without the use of fimplicit this is just a hyperbola.
f = @(x,y) y.*(1 + y/2) - x.^2;
fimplicit(f,[-pi,pi])
You want something of an easier method than this?
Sigh. This was probably homework. But then, the use of fimplicit is probably not allowed in homework. In that case, suppose you knew the value of x. Could you then solve for y? Hint: how would the quadratic forrmula apply here? Could you find both roots of the quadratic in y, as a function of x?
  1 Comment
Dan
Dan on 29 Jan 2021
Tell your mom I said hi

Sign in to comment.


VBBV
VBBV on 30 Jan 2021
syms x y
f = @(x,y) y.*(1+0.5*y)-x.^2;
fplot(f(x,10),[-pi pi])
You could also use fplot function as well

Community Treasure Hunt

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

Start Hunting!