K Khang Lê New member Sep 19, 2021 #1 What will be the output for the below block of code? Code: P=[1 3 2]; r=roots(P); A. r=[-2,-2] B. r=[-2 -1] C. There is an error in the code D. r = -2 -1
What will be the output for the below block of code? Code: P=[1 3 2]; r=roots(P); A. r=[-2,-2] B. r=[-2 -1] C. There is an error in the code D. r = -2 -1
K Kim Thu Đoàn New member Sep 19, 2021 #2 Answer: d Explanation: The function roots(p) generate a column vector, and not a row vector, containing the roots of a polynomial. So option a and b cannot be the answer and there is no error in the code. The answer is option d. Output: r = -2 -1 Upvote 0 Downvote
Answer: d Explanation: The function roots(p) generate a column vector, and not a row vector, containing the roots of a polynomial. So option a and b cannot be the answer and there is no error in the code. The answer is option d. Output: r = -2 -1