Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

what is an inner transition metal with 5 4 f electrons?

Answered: 1 week ago