MATLAB - Numerical Methods
What is the output of the following MATLAB code?
p = [1 -3 2]; % Represents x^2 - 3x + 2 r = roots(p);
p = [1 -3 2]; % Represents x^2 - 3x + 2 r = roots(p);
p = [1 -3 2] represents the polynomial x^2 - 3x + 2.(x-1)(x-2) = 0 so roots are 1 and 2. MATLAB returns a column vector [2; 1], matching option [2 1].15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions