Question: Problem It a second order polynomial is written in the general forms +h+c=0 then the roots (le the values of that satisfy the equation) can

 Problem It a second order polynomial is written in the general
forms +h+c=0 then the roots (le the values of that satisfy the

Problem It a second order polynomial is written in the general forms +h+c=0 then the roots (le the values of that satisfy the equation) can be determined using the quadratic formula: * = - + V6 - 4 201 You will be given a 3-element row vector (a, b, c) as an input. The goal is to write a function that does the following 1. Check if the roots of the polynomial defined by a, b,and e are real and distinct. Note that the roots will be real if the value under the square root is greater than or equal to zero. They will not be distinct, however, if the value under the square root is exactly equal to zero. Assign an an integer (uints datatype) value to the output variable rootCondition you may choose a different name) as follows: The value 2 if the roots are real and distinct . The value 1 if the two roots are the same The value of the roots are not realle. complex because the value under the square root is less than 0) 2. Assign the solution to the quadratic to the output variable rootValues (you may choose a different name) according to the following guidelines: In cases where there are two real and distinct roots, compute the two roots and assign them in ascending order to a two-element row vector In cases where the two roots are the same, compute the root and assign this value to both elements in a two-element row vector In cases where the roots are complex output assign the text 'complex roots' output variable rootValues . Task Task Write a function quadratic Solver that takes one 3-element array input and returns two outputs (root condition and root values). Use an if-elseif-else structure in your code. Function Save e Reset MATLAB Documentation 1 Modify the function header below 2 function CHANGE_THIS_HEADER * YOUR CODE STARTS 4 * YOUR CODE ENOS end Code to call your function Reset 1 [rootCondition, rootValues1] - quadraticsolver(2-4 -5])

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!