ENGR 111 Study Guide - Midterm Guide: Matlab, Extended Precision

63 views1 pages

Document Summary

Objective: use logic and conditionals in a matlab script. Cfu 8. 2 - logic and conditionals. You should work on this task individually. The discriminant of a polynomial is an expression which gives information about the nature of the polynomial"s roots. Write a matlab script that will compute the discriminant of the following polynomial: (the discriminant is. Where a , b and c are considered inputs and d is the discriminant. (all extended precision) Have the user input a , b and c and output the value of the discriminant and the appropriate message. Please note that the actual computation results may not be correct. This example is intended to elucidate matters of format only. D = b^2 - 4 * a * c; if d > 0 disp ("two real roots") elseif d == 0 disp ("one real root") else disp ("no real root") end.