Question: Matlab Question the equation is ax^2 + bx +c = 0 please include notes My work: not sure how to continue... function [x1, x2] =

Matlab Question

Matlab Question the equation is ax^2 + bx +c = 0 please

the equation is ax^2 + bx +c = 0

please include notes

My work: not sure how to continue...

function [x1, x2] = myquadratic(a, b, c)

if isscalar(a) && isscalar(b) && isscalar(c)

x1 = (-b + sqrt(b^2 - 4*a*c)) / (2*a);

x2 = (-b - sqrt(b^2 - 4*a*c)) / (2*a);

Create a function called muquadratic, which has three inputs: a,b, and c, and has two outputs: x1 and x2. Inside the function, compute the two roots (x1 and x2) of the quadratic polynomial which is formed using the following expression: a2+6x2+c=0 Directly use the quadratic formula to solve for each of the two roots; do not use the roots() command. The first output should be the smaller of the two roots. Your function should work with scalar values for a,b, and c, as well as when the input variables are one-dimensional arrays of coefficients. The two output variables in this case should also be one-dimensional arrays of the same size as the inputs. Test your function by running it in the Command Window with the following inputs: mxquadratic(1,11,10)ans=[y,z]=mxquadratic([112],[1116,[1030])y=ans10=10y=5[y,z]=myquadratic(1,11,10)z=y=13z=1 Your function m-file should be saved with the same name as your function. Do not display any intermediate results from your function; all lines which display outputs should be semicolonterminated. Do not use the disp() function. All inputs should be passed into to the function through functions calls; do not use the input() function. You may use vectorization or a loop to handle the non-scalar-input cases

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!