How to find polynomial roots in Simulink?
Afficher commentaires plus anciens
Hi,
I am trying to solve a 4th order polynomial equation in Simulink. I need to solve the equation by using Simulink blocks. The coefficients are calculated in Simulink blocks as well and I need to find the roots of this equations for each iteration.
To be more clear, I am using a for iterator block in Simulink and iterate 1000 times, in this for loop certain coefficients (C1,C2, C6 etc) are calculated from math expressions in each iteration. And I neet to find the roots of the polynomial whose coefficients are those calculated C values and I need find the roots for each iteration. I do not want to use script or built-in functions, but solve this problem with Simulink blocks if possible. Below I share a piece of m script which does exactly what I need to do in Simulink.
Any help will be appriciated, thanks in advance.
r = roots([C5 (-C1+2*C4-C6) (3*C2-3*C5) (C1-2*C3+C6) -C2]);
r = r(r==conj(r)); % discard complex-conjugate roots
r = r(r>0); % discard negative roots
Réponse acceptée
Plus de réponses (1)
Sai Teja Paidimarri
le 18 Juin 2020
Modifié(e) : Walter Roberson
le 22 Juin 2020
Hi Ozan Eren,
You can find roots in Simulink and Matlab as well.
For a polynomial c5 x^4 + c4 x^3 +c3 x^2 +c2 x + c1, roots r can be found out using below steps
x = c4 + r*c5;
y = c3 + r*x;
z = c2 + r*y;
r value for which c1+r*z is zero is root of equation.
Above equations are from the concept of synthetic division method.
Counter, logical operator and constants can be used in case of Simulink implementation.
For or while loop can be used in case of Matlab Implementation.
3 commentaires
ozan eren
le 22 Juin 2020
Sai Teja Paidimarri
le 23 Juin 2020
Hi ozan eren
First you need to find x,y,z because z depends on y , y depends upon x .Then condition associated with z.After that you can use r (using counter in simulink and any loop in matlab) to check the condition assocaited with z. if condition satisfies you can move r value in roots (declare roots as an array).
You can refer synthetic division method for understanding the above formulae.
ozan eren
le 23 Juin 2020
Catégories
En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!