Quadratic equation | My Assignment Tutor

Write a MATLAB script to generate a matrix which has the values d along the main diagonal and the values c on the diagonals above and below the main diagonal and zero elsewhere. Your script should allow the user to input any values for c and d and work for any size of matrix n. The script should give clear prompts for input and display the results with a suitable heading. Write a MATLAB function to solve the quadratic equation ax2 + b x +c = 0 The function will use three input parameters a, b, c and output the values of the two roots. You should take account of the three cases: (a) no real roots (b) real and different roots (c) equal roots Hint: Develop the function rootquad given in Section 1.19


Leave a Reply

Your email address will not be published. Required fields are marked *