MATLAB: Displaying a quadratic equation

homeworkquadratic equations

Hi im very new to Matlab and help would be greatly appreciative
Consider the quadratic equation of the form: ax^2 + bx + c = 0, where a,b,c are constants
(a) Write a MATLAB function having the coefficients a, b, c as input arguments to determine the quadratic roots of the equation. Specifically, display the two roots in the Command Window using the following format:
The first root = r1 The second root = r2
(b) Utilize the function created in part (a) to find the roots of the quadratic equations specified by the Lab TA. Tabulate the results.

Best Answer

The roots() command will be helpful, see "doc roots" for usage. The disp command should also help, e.g,
>> disp(['Here is a number, ', num2str(3), '. It is the number three.'])
displays,
Here is a number, 3. It is the number three.