System of Nonlinear Equations are failing to be solved
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Torsten
2022-9-25
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)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!