フィルターのクリア

how can i solve this function

2 ビュー (過去 30 日間)
afrah aziz
afrah aziz 2020 年 11 月 27 日
回答済み: Image Analyst 2020 年 11 月 27 日
The classic quadratic formula says that the two roots of the quadratic equation ax2+bx+c=0 are x1,x2=(-b±√(b2-4ac). Write a function that keep solutions x1,x2 and use this function in another script file. It takes as integers to input the values ​​of a, b, and c and solve the equation using the first function you define in step one. Finally, use this to solve the equation 8x2+4x-2=0.
  1 件のコメント
David Hill
David Hill 2020 年 11 月 27 日
編集済み: David Hill 2020 年 11 月 27 日
Look at roots()
roots([8 4 -2]);

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

回答 (1 件)

Image Analyst
Image Analyst 2020 年 11 月 27 日
You can use roots() to find the solutions. Then simply put roots() into a function and call it in a script.
a = 3;
b = ..........
[x1, .....] = SolveQuadratic(a, b, ....................
% SolveQuadratic is a function you write that calls roots inside it and returns the two roots.
etc.
Try these for more help on your homework:

カテゴリ

Help Center および File ExchangeQuadratic Programming and Cone Programming についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by