Solving a cubic polynomial by using two loops
显示 更早的评论
I want to solve a cubic equation of the form a*Z^3+b*Z^2+c*Z+d=0, where b=0.0:0.01:10 and c=0.0:0.1:10. I'm new to MATLAB, can anyone help me out?
1 个评论
John D'Errico
2021-2-17
Sorry, but this makes no sense. You claim a polynomial with FOUR coefficients, but you want to specify only two of them. So the result will still be a nasty complex mess. And that means your question is still mathematically under-posed.
Anyway, make an effort! Start by writing a pair of nested loops. This is still effectively homework. If we do your thinking for you, then you will learn nothing, except that you can get some fool to do your work for you. Think about what result you will expect. After all, this is a CUBIC polynomial. How many roots are there? Once you define all four coefficients, how many roots does a cubic have? May some of them be complex?
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!