Why does transforming transfer matrix into complex vector transfer function lead to NaN ?

6 次查看(过去 30 天)
Hi,
I am currently trying to transform my transfer matrix into compex vector form. The following picture shows how it is theoretically done.
My is Z_2 and has quite a high order. So when I try to use eq. (F2) to get Matlab returns Z_2_cmplx = NaN. Here is my code:
%% Calculation of Transfer Function
% Parameters
Lf_1 = 5.6e-3;
Rf_1 = 0.1;
Cf_1 = 1.61e-05;
L_1 = 1.46e-3 ;
R_1 = 0.053;
wn = 2*pi*50;
Kpc_1 = 35.839999999999996;
Kic_1 = 8.789333333333335e+02;
Kpv_1 = 0.027560488364344;
Kiv_1 = 12.664025834171640;
F_i = 0.9;
% Calculating Transfer Functions
s = tf('s');
Z_PIi = (Kpc_1 + Kic_1 * 1/s) ;
Z_CDi = (-wn*Lf_1) * [0 -1;1 0];
Z_inner = (Z_PIi + (s*Lf_1 + Rf_1))*[1 0;0 1] + (wn*Lf_1)*[0 -1;1 0] + Z_CDi;
Z_inner_inv = inv(Z_inner);
G_I = Z_PIi / Z_inner;
Z_PIv = 1/(G_I * ((Kpv_1 + Kiv_1 * 1/s) * [1 0;0 1]));
Z_PIv_inv = inv(Z_PIv); %Removes extra s
Z_CDv = -1/((wn*Cf_1*[0 -1;1 0])*G_I);
Z_CDv_inv = inv(Z_CDv);
Z_parallel_inv = Z_PIv_inv + Z_CDv_inv + [s*Cf_1 -wn*Cf_1;wn*Cf_1 s*Cf_1] + Z_inner_inv; %equal to Zinner//Zpar mentioned in the notes
Z_parallel = 1/Z_parallel_inv;
Z_1 = Z_parallel/Z_PIv;
Z_ov = [R_1, -wn*Lv_1;
wn*Lv_1, R_1];
Z_Fi = -Z_parallel / inv(G_I)*F_i;
%% Transformation into complex vector form
Z_2 = Z_parallel + Z_Fi + (Z_ov * Z_1);
Z_2_cmplx = (Z_2(1,1)+Z_2(2,2))/2 + 1i * (Z_2(2,1)+Z_2(1,2))/2 % This yields NaN :/
Can anyone please help me with this? I am really out of ideas on how to solve this issue.
Thanks a lot!!!!
Merve
  2 个评论
Paul
Paul 2021-10-27
Can't run the code because, variable Lv_1 is undefined.
Also, the expression for Z_2_cmplx doesn't follow the equation in the picture. It should be
Z_2_cmplx = (Z_2(1,1)+Z_2(2,2))/2 + 1i * (Z_2(2,1) - Z_2(1,2))/2
Because Z_2_cmplx is supposed to be G_dq_plus (I think).
Merve Can
Merve Can 2021-10-27
Hi Paul,
thank you for your answer. Yes, sorry it should be a “-“.Nevertheless, I am getting NaN.
Lv_1 = (5.6e-3)*3;
Can you run the code now?

请先登录,再进行评论。

采纳的回答

Paul
Paul 2021-10-27
Recreating the result
%% Calculation of Transfer Function
% Parameters
Lf_1 = 5.6e-3;
Rf_1 = 0.1;
Cf_1 = 1.61e-05;
L_1 = 1.46e-3 ;
R_1 = 0.053;
Lv_1 = (5.6e-3)*3;
wn = 2*pi*50;
Kpc_1 = 35.839999999999996;
Kic_1 = 8.789333333333335e+02;
Kpv_1 = 0.027560488364344;
Kiv_1 = 12.664025834171640;
F_i = 0.9;
% Calculating Transfer Functions
s = tf('s');
Z_PIi = (Kpc_1 + Kic_1 * 1/s) ;
Z_CDi = (-wn*Lf_1) * [0 -1;1 0];
Z_inner = (Z_PIi + (s*Lf_1 + Rf_1))*[1 0;0 1] + (wn*Lf_1)*[0 -1;1 0] + Z_CDi;
Z_inner_inv = inv(Z_inner);
G_I = Z_PIi / Z_inner;
Z_PIv = 1/(G_I * ((Kpv_1 + Kiv_1 * 1/s) * [1 0;0 1]));
Z_PIv_inv = inv(Z_PIv); %Removes extra s
Z_CDv = -1/((wn*Cf_1*[0 -1;1 0])*G_I);
Z_CDv_inv = inv(Z_CDv);
Z_parallel_inv = Z_PIv_inv + Z_CDv_inv + [s*Cf_1 -wn*Cf_1;wn*Cf_1 s*Cf_1] + Z_inner_inv; %equal to Zinner//Zpar mentioned in the notes
Z_parallel = 1/Z_parallel_inv;
Z_1 = Z_parallel/Z_PIv;
Z_ov = [R_1, -wn*Lv_1;
wn*Lv_1, R_1];
Z_Fi = -Z_parallel / inv(G_I)*F_i;
Z_2 = Z_parallel + Z_Fi + (Z_ov * Z_1);
Z_2_cmplx = (Z_2(1,1)+Z_2(2,2))/2 + 1i * (Z_2(2,1)-Z_2(1,2))/2 % This yields NaN :/
Z_2_cmplx = NaN Static gain.
Look at the coefficients of the numerator and denominator of Z_2(1,1). They are enormous, here's the five largest. Same thing with Z_2(2,2)
[num,den] = tfdata(Z_2(1,1));
sortnum = sort(num{:});
sortden = sort(num{:});
sortnum(end-5:end)
ans = 1×6
1.0e+186 * 0.0271 0.1262 0.4510 1.1589 1.4996 1.9038
sortden(end-5:end)
ans = 1×6
1.0e+186 * 0.0271 0.1262 0.4510 1.1589 1.4996 1.9038
When Z_2(1,1) and Z_2(2,2) are combined, problems result with the coefficients getting too large.
[num,den] = tfdata(Z_2(1,1)+Z_2(2,2));
any(isinf(num{:}))
ans = logical
1
any(isinf(den{:}))
ans = logical
1
There may be a better way to do all that transfer function manipulation. Are those equations derived from a block diagram?
  6 个评论
Merve Can
Merve Can 2021-11-2
Maybe I can explain it in a better way in an e-mail. Could you please contact me via merve.can@campus.tu-berlin.de?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by