Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use Matlab... and the given variables. Write a function called real_roots that determines the real roots of a quadratic equation bx. To calculate the roots
Use Matlab... and the given variables.
Write a function called real_roots that determines the real roots of a quadratic equation bx. To calculate the roots of the equation, the function calculates the discriminant D, given by: If D >0, there are two real roots. -b + VD and If D 0, there is only one (double) root, If Dc0, there are no real roots. The function must take three inputs, a, b, and c (in that order), and provide two outputs(the two roots), with NaN as the default value if less than two roots exist. For example if there is one real root of 4, the function returns 4 and NaN. If there are no real roats, it returns NaN and NaN. If there are two real roots, the function must return them in descending order. For example, if the roots are 2 and 4, it must return them in the order: 4, 2. Your Function C Reset MATLAB Documentation Code to call your function C Reset 1[rl, r2] - real roots(1,2,1) 2r3, r4]-real_roots (1,1,1) 13| [rs, r6] = real-roots(2, 8, 3)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