Why does transforming transfer matrix into complex vector transfer function lead to NaN ?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Merve Can
el 27 de Oct. de 2021
Comentada: Paul
el 2 de Nov. de 2021
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 comentarios
Paul
el 27 de Oct. de 2021
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).
Respuesta aceptada
Paul
el 27 de Oct. de 2021
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 :/
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)
sortden(end-5:end)
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{:}))
any(isinf(den{:}))
There may be a better way to do all that transfer function manipulation. Are those equations derived from a block diagram?
6 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!