quadratic - else if(b^2-4*a*c == 0 disp'Repeated solutions...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function y = quadratic(a, b, c) x1 = (-b + sqrt((b^2)-4*a*c))/(2*a); x2 = (-b - sqrt((b^2)-4*a*c))/(2*a); if (b^2)-4*a*c < 0 disp('Sorry, Solutions are imaginary numbers.');
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: else if (b^2)-4*a*c == 0 disp('Repeated solutions are:'); disp(x1); else disp('Two solutions are:'); disp(x1); disp(x2); end end end...
View Full Document

This note was uploaded on 11/06/2011 for the course EE 150 taught by Professor Dr.burke during the Fall '08 term at USC.

Ask a homework question - tutors are online