Solving a cubic polynomial by using two loops
Show older comments
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 Comment
John D'Errico
on 17 Feb 2021
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?
Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!