フィルターのクリア

solving system of 2 equations with complex components

1 回表示 (過去 30 日間)
Patxi
Patxi 2021 年 2 月 18 日
コメント済み: Patxi 2021 年 2 月 18 日
Hello,
I'm trying to solve a complex equation which it is proposed in two, separately, taking the module (1) and the angle (2). The solution must be ki=242.1123 and kp=5.7424, but unfortunatelly it is not be able to solve it. Can somebody help me?
Thanks!
-------
% Original complex equation, Open Loop Transfer Function, OLTF(s)=Gpi(s)*G(s)=(kp·s+ki)/s · Kt/(J·s+Bv),
% -> s=jw for frequency domain (Bode)-->OLTF(jw)=OLTF(w*1i)=Kt*(kp*w*1i+ki)/(Bv*w*1i-J*w^2)
syms ki kp
J=0.057;Bv=0.015;w=300;PM=82*pi/180;Kt=2.9489;
eqns=[abs(Kt*(kp*w*1i+ki)/(Bv*w*1i-J*w^2))==1,angle(Kt*(kp*w*1i+ki)/(Bv*w*1i-J*w^2))==PM-pi]; % eq(1),eq(2)
S=vpasolve(eqns,[ki kp])
% no solution
S.ki
ans =
Empty sym: 0-by-1
S.kp
ans =
Empty sym: 0-by-1
-------

採用された回答

Alan Stevens
Alan Stevens 2021 年 2 月 18 日
Here's a non-symbolic way to solve your equations
ki0 = 200; kp0 = 10;
k0 = [ki0, kp0];
k = fminsearch(@search,k0);
ki = k(1); kp = k(2);
disp(k)
function F = search(k)
J=0.057;Bv=0.015;w=300;PM=82*pi/180;Kt=2.9489;
ki = k(1); kp = k(2);
d1 = abs(Kt*(kp*w*1i+ki)/(Bv*w*1i-J*w^2))-1;
d2 = angle(Kt*(kp*w*1i+ki)/(Bv*w*1i-J*w^2))-(PM-pi);
F = norm(d1)+norm(d2);
end
  1 件のコメント
Patxi
Patxi 2021 年 2 月 18 日
thank you very much for your help. I'm very grateful for that!
Regards,
Patxi

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by