Question: Question 3 2 pts Consider the following two MATLAB function definitions: function x = two_roots(a, b, c) % Returns the roots of the polynomial %


Question 3 2 pts Consider the following two MATLAB function definitions: function x = two_roots(a, b, c) % Returns the roots of the polynomial % y = Ax^2 + BX + c soli = (-b + sqrt(5^2 - 4*a*c)) / (2*a); sol2 = (-b - sqrt(b^2 - 4*a*c)) / (2*a); x = [soli sol2]; function xroots = plot_quad(a, b, c, xrange) % plots the quadratic equation y = Ax^2 + Bx + c % from -xrange to xrange. % Also, plots the points where it crosses the x-axis and % returns the roots of the polynomial XX = -xrange: 0.1:xrange; yy = a*xx.^2 + b*xx + c; CODE yroots = a*xroots.^2 + b*xroots + C; plot(xx,yy, [-xrange xrange],[00], xroots, yroots,'o'); Which code choice replaces the line CODE, in the second function definition, so that the second function correctly calls the first function to find the roots of the quadratic polynomial? xroots = two_roots(a,b,c); x = two_roots (2,3,-14); XX = two_roots(a,b,c); xroots = two_roots(2,3,-14); xx = two_roots(2,3, -14); x = two_roots(a,b,c)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
