Question: MATLAB: Create a function called myquadratic , which has three inputs: a , b , and c , and has two outputs: x1 and x2

MATLAB: Create a function called myquadratic, 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:

MATLAB: Create a function called myquadratic, which has three inputs: a, b,

Create a function called myquadratic, 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: ax2+bx+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: 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 semicolon-terminated. 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!