简体   繁体   English

如何在matlab中求解和绘制三次方程

[英]How to solve and plot a cubic equation in matlab

I am pretty new with matlab, and right now I am a bit lost.我对matlab很陌生,现在我有点迷茫。 I want to solve the following cubic equation and then plot both real and imaginary roots:我想求解以下三次方程,然后绘制实根和虚根:

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

Where l is a parameter between [-10 10] and x[-5 5].其中 l 是 [-10 10] 和 x[-5 5] 之间的参数。 Thank you谢谢

Is it always going to be?会一直这样吗?

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

If so, you can use the roots function如果是这样,您可以使用roots函数

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

Where the vector is the equation's coefficients其中向量是方程的系数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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