Question: 1. Write a user-defined MATLAB function which tkes the coefficients of the quadratic equation az^2+bz+c=0 as inputs and returns its values z1 and z2 as

1. Write a user-defined MATLAB function which tkes the coefficients of the1. Write a user-defined MATLAB function which tkes the coefficients of the quadratic equation az^2+bz+c=0 as inputs and returns its values z1 and z2 as outputs. For function name and arguments use: [x1,x2] = myquad1(a,b,c)

2. Repeat the procedure, but this time with an anonymous MATLAB fuction called myquad2 which takes a, b, and c as inputs and returns the roots in 2x1 column vector as the output.

3. Test function to find the roots of 3x^2 + 5x-1=0 Perform a sanity check in user defined function to make sure the real roots exist. Otherwise return a warning message and assign NaN to x1 and x2.

1 Wite a user -deined MATLAB tunction which takes tne cocficients of te quadran equdion az2 + bu +e-0 as inpens and velustss ncion name and arguments, use and z as asputs Far [x1, x2] myquad1 a, b, c) 2-Repeal the procedure but this time waile an anonynioUS MA ILAB tunction calleri inyqusa2 which takes a b and c as inouts and etanits bhe soots inax I 3- Test yuur tuncaons lo find the noots or 3z 5z- 0 and see n they rctun the comed aswer I -0.1805 1871 omenise rHurn a waming message and assige NaNio zs and z

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!