Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 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 x3 and x2.image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions