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

76 visualizaciones (últimos 30 días)
write a MATLAB commads to find the roots of : ax^2+bx+c=0 , where a,b and c are constants?

Respuesta aceptada

jahanzaib ahmad
jahanzaib ahmad el 13 de En. de 2019
Editada: madhan ravi el 15 de En. de 2019
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 comentario
jahanzaib ahmad
jahanzaib ahmad el 14 de En. de 2019
Editada: madhan ravi el 15 de En. de 2019
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);

Iniciar sesión para comentar.

Más respuestas (2)

madhan ravi
madhan ravi el 14 de En. de 2019
Editada: madhan ravi el 14 de En. de 2019
help roots
doc roots
help poly2sym
doc poly2sym

Abu Samad
Abu Samad el 15 de Abr. de 2022
ax^2+bx+c=0 where abc[1,-3,2]

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by