36. The roots of a cubic equation can be calculated using the following procedure: Set: , ,...

Question:

36. The roots of a cubic equation can be calculated using the following procedure:

Set: , , and .

Calculate: , where and .

If the equation has complex roots.

If all roots are real and at least two are equal. The roots are given by:

, , and .

If all roots are real and are given by:

, , and

, where .

Write a MATLAB program that determines the real roots of a cubic equation.

As input the program asks the user to enter the values of a3, a2, a1, and a0 as a vector. The program then calculates the value of D. If the equations have complex roots, the message “The equation has complex roots” is displayed.

Otherwise the real roots are calculated and displayed. Use the program to solve the following equations:

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: