solving quadratic roots in matlab

4 Ansichten (letzte 30 Tage)
yumna
yumna am 8 Mär. 2024
Kommentiert: James Tursa am 9 Mär. 2024
the question asks: How would i write a (Script) to calculate the two roots of any quadratic equation of the form 𝑎𝑥2 + 𝑏𝑥 + 𝑐 = 0 using the function input to enter the values of 𝑎, 𝑏 and 𝑐 from the keyboard. As well as using strings and the function disp to display the result in matlab?
Check the correct operation of the program yourself by running it on thefollowing examples:
5𝑥2 + 11𝑥 + 5 = 0
5𝑥2 + 10𝑥 + 5 = 0
5𝑥2 + 9𝑥 + 5 = 0
and comparing their outputs with the solutions obtained by hand calculation. Do not use the function roots.

Antworten (1)

Matt J
Matt J am 8 Mär. 2024
Hint: You should consider applying the quadratic formula.

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by