Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. Write MATLAB code that calculate the three roots of a cubic equation of state using MATLAB's roots function. After determining the three roots, your
3. Write MATLAB code that calculate the three roots of a cubic equation of state using MATLAB's roots function. After determining the three roots, your code should display the number of distinct values of the roots: ("Three identical roots," "Two identical roots," or "Three distinct roots"). Your code should then state if the roots are real or complex ("All roots are real" or "Two roots are complex"). Hints: MATLAB is solving for the roots numerically, not symbolically, so the result is a (very precise) numerical approximation. Determining if roots are identical using rl--r2 may not work. To determine if floating point values of the roots are equal, define a tolerance (tol-0.0001, for example) and determine if abs(r1-r2)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started