System of Nonlinear Equations are failing to be solved

2 ビュー (過去 30 日間)
Labid Bin Bashar
Labid Bin Bashar 2022 年 9 月 25 日
コメント済み: Labid Bin Bashar 2022 年 9 月 26 日
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])
sol1 = 
0.40751782462346212168748687200968
sol2 = 
0.1065888515318568220223455502278

採用された回答

Torsten
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)
  1 件のコメント
Labid Bin Bashar
Labid Bin Bashar 2022 年 9 月 26 日
Thank you very much, it works now.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by