How do I generate a polynomial from roots that are repeated?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Guillem Campins
le 28 Nov 2020
Commenté : Star Strider
le 28 Nov 2020
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 commentaires
Réponse acceptée
Star Strider
le 28 Nov 2020
Modifié(e) : Star Strider
le 28 Nov 2020
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 commentaires
Plus de réponses (1)
Image Analyst
le 28 Nov 2020
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 commentaires
Image Analyst
le 28 Nov 2020
Maybe might have to use the symbolic toolbox, which I don't have, to do the multiplication.
Voir également
Catégories
En savoir plus sur Polynomials dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!