Real solutions to a polynomial
Show older comments
Hi, I am stuck to this task: I am trying only to get the real solutions to the function
A = [1 -12 55 -120 124 -80]
B = roots(A)
4 Comments
Scott MacKenzie
on 24 Apr 2021
Edited: Scott MacKenzie
on 24 Apr 2021
First of all
A = [1 -12 55 -120 124 -80]
is not a function. But
A = [1 -12 55 -120 124 -80]
B = roots(A)
yields
B =
4.699 + 0i
3.067 + 1.6505i
3.067 - 1.6505i
0.58351 + 1.031i
0.58351 - 1.031i
so, all the roots for the polynomial with the terms in A are imaginary, except the first:
>> isreal(B(1))
ans =
logical
1
Robert Bag
on 24 Apr 2021
Robert Bag
on 24 Apr 2021
Robert Bag
on 24 Apr 2021
Answers (1)
A = randi([-9 9], 1, 6)
B = roots(A)
B(imag(B)==0)
Categories
Find more on Digital Filter Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!