简体   繁体   中英

How to solve and plot a cubic equation in matlab

I am pretty new with matlab, and right now I am a bit lost. I want to solve the following cubic equation and then plot both real and imaginary roots:

x^3-d*(x^2)+1 =0

Where l is a parameter between [-10 10] and x[-5 5]. Thank you

Is it always going to be?

y=x^3-d*(x^2)+1 ?

If so, you can use the roots function

y = roots([1, -d, 0, 1]);

Where the vector is the equation's coefficients

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM