System of Nonlinear Equations are failing to be solved
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Labid Bin Bashar
le 25 Sep 2022
Commenté : Labid Bin Bashar
le 26 Sep 2022
Hello Altruists,
I am trying to solve the system of nonlinear equations using both fsolve() and vpasolve(). However, they are failing to provide any result and end up in some empty symbolic variables (for vpasolve()) or just stopped iteration at some point (for fslove()). The code given below is a simplified version of my code. In this case, I have to solve two equations (in reality 5 equations) eq1 and eq2 to find out the roots Kp, Ki. How can I solve this problem?
syms Kp ;
syms Ki ;
Kd = 0.2023;
lm = 1.1477;
mu = 0.9973;
phi_m = 80;
w_gc = 0.3;
L = 0.2694;
K = 0.42456;
p2zw = 1.2157;
wn = 0.50679;
a = 2.109;
b = 1.015;
P_mag = K / ((w_gc^(a)*cos(a*pi/2) + p2zw*w_gc^(b)*cos(b*pi/2) + wn^2)^2 + (w_gc^(a)*sin(a*pi/2) + p2zw*w_gc^(b)*sin(b*pi/2))^2);
P_arg = -w_gc*L-atan((w_gc^a*sin(a*pi/2))+(p2zw*w_gc^b*sin(b*pi/2))/(w_gc^a*cos(a*pi/2))+(p2zw*w_gc^b*cos(b*pi/2)+w_gc^2));
C_mag = sqrt((Kp + (Ki*w_gc^(-lm)*cos(lm*pi/2)) + Kd*w_gc^mu*cos(mu*pi/2))^2+((-Ki*w_gc^(-lm)*cos(lm*pi/2)) + Kd*w_gc^mu*sin(mu*pi/2))^2);
C_arg = atan(((-Ki*w_gc^(-lm)*cos(lm*pi/2)) + Kd*w_gc^mu*sin(mu*pi/2))/(Kp + (Ki*w_gc^(-lm)*cos(lm*pi/2)) + Kd*w_gc^mu*cos(mu*pi/2)));
eq1 = C_arg + P_arg == pi-phi_m*pi/180;
eq2 = C_mag*P_mag == 1;
[sol1, sol2] = vpasolve([eq1 eq2],[Kp Ki])
0 commentaires
Réponse acceptée
Torsten
le 25 Sep 2022
In my opinion, it should be
eq1 = C_arg + P_arg == pi-phi_m*pi/180;
instead of
eq1 = C_arg + P_arg == pi-phi_m*180/pi;
(see above)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Calculus 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!