write a matlab command to find th roots of: ax^2+bx+c=0

조회 수: 77 (최근 30일)
Ammaa AlSada
Ammaa AlSada 2019년 1월 13일
댓글: Walter Roberson 2022년 4월 15일
write a MATLAB commads to find the roots of : ax^2+bx+c=0 , where a,b and c are constants?

채택된 답변

jahanzaib ahmad
jahanzaib ahmad 2019년 1월 13일
편집: madhan ravi 2019년 1월 15일
a=1;
b=2;
c=3;
x1 = -b +(sqrt((b^2)-(4ac)/(2a))x;
x2=-b-(sqrt((b^2)-(4ac)/(2a));
disp(x1);
disp(x2);
  댓글 수: 1
jahanzaib ahmad
jahanzaib ahmad 2019년 1월 14일
편집: madhan ravi 2019년 1월 15일
a=1;
b=2;
c=3;
x1 = -b +(sqrt((b.^2)-(4.*a.*c)))/(2.*a);
x2=-b -(sqrt((b.^2)-(4.*a.*c)))/(2.*a);
disp(x1);
disp(x2);

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

madhan ravi
madhan ravi 2019년 1월 14일
편집: madhan ravi 2019년 1월 14일
help roots
doc roots
help poly2sym
doc poly2sym

Abu Samad
Abu Samad 2022년 4월 15일
ax^2+bx+c=0 where abc[1,-3,2]

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by