Solving a cubic polynomial by using two loops
Afficher commentaires plus anciens
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 commentaire
John D'Errico
le 17 Fév 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?
Réponses (0)
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!