How do I generate a polynomial from roots that are repeated?
5 次查看(过去 30 天)
显示 更早的评论
So I've got the roots of a polynomial from which I want to design the polynomial.
The thing is that I've got 8 roots, 4 of which are repeated. These are the roots I have:
-0.7437 - 1.4178i
-0.7437 - 1.4178i
-1.1031 + 0.1267i
-1.1031 + 0.1267i
-0.4571 + 0.9526i
-0.4571 + 0.9526i
-0.0977 + 1.0976i
-0.0977 + 1.0976i
When I do the polynomial by using the function poly, I get the polynomial that corresponds to the 8 roots but I'd like the polynomial for only the 4, non-repeated roots.
How could I do this? (I know I could probably eliminate the repeated, but I'd like a function that considers repeated roots or something).
Thanks in advance
0 个评论
采纳的回答
Star Strider
2020-11-28
编辑:Star Strider
2020-11-28
Iinteresting. I would expect no repeats, and complex conjugate values instead.
Try this:
rts = [ -0.7437 - 1.4178i
-0.7437 - 1.4178i
-1.1031 + 0.1267i
-1.1031 + 0.1267i
-0.4571 + 0.9526i
-0.4571 + 0.9526i
-0.0977 + 1.0976i
-0.0977 + 1.0976i];
Urts = unique(rts);
p1 = poly(Urts);
Ucrts = [Urts; conj(Urts)];
p2 = poly(Ucrts);
.
4 个评论
更多回答(1 个)
Image Analyst
2020-11-28
Did you try just multiplying them all together?
x = linspace(-8, 5, 1000);
r1 = -0.7437 - 1.4178i
r2 = -0.7437 - 1.4178i
r3 = -1.1031 + 0.1267i
r4 = -1.1031 + 0.1267i
r5 = -0.4571 + 0.9526i
r6 = -0.4571 + 0.9526i
r7 = -0.0977 + 1.0976i
r8 = -0.0977 + 1.0976i
y = (x-r1).*(x-r2).*(x-r3).*(x-r4).*(x-r5).*(x-r6).*(x-r7).*(x-r8)
plot(x, real(y), 'r-', 'LineWidth', 2);
hold on;
plot(x, imag(y), 'b-', 'LineWidth', 2);
grid on;
legend('Real', 'Imaginary');
2 个评论
Image Analyst
2020-11-28
Maybe might have to use the symbolic toolbox, which I don't have, to do the multiplication.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!