solving quadratic roots in matlab

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.

1 件のコメント

James Tursa
James Tursa 2024 年 3 月 9 日
What have you done so far?

サインインしてコメントする。

回答 (1 件)

Matt J
Matt J 2024 年 3 月 8 日

0 投票

Hint: You should consider applying the quadratic formula.

カテゴリ

ヘルプ センター および File ExchangeWorkspace Variables and MAT Files についてさらに検索

質問済み:

2024 年 3 月 8 日

コメント済み:

2024 年 3 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by