- https://www.mathworks.com/help/symbolic/sym.vpasolve.html
- https://www.mathworks.com/help/optim/ug/fsolve.html
How to solve two equations two unknowns for the equations with syms?
10 views (last 30 days)
Show older comments
I am trying to calculate solutions for the two equation two unknown type scenario. But, the solver is not able to give any explicit solution. The unknows are syms type transfer functions H_mi_thetadcap and H_mi_vtest.
clc
clear
%% Parameters
Vm = 277 * sqrt(6) ;
ws = 2 * pi * 85000 ;
Lp = 28.3e-6 ;
RLp = 77.55e-3 ;
Zpss = ( ws * Lp * 1i ) + RLp ;
Cpp = 123.13e-9 ;
RCpp = 13.55e3 ;
Zppss = RCpp / ( 1 + RCpp * Cpp * ws * 1i ) ;
Cps = 160.32e-9 ;
RCps = 8e3 ;
Zpsss = RCps / ( 1 + RCps * Cps * ws * 1i ) ;
Ll = 37.45e-6 ;
RLl = 25.85e-3 ;
Zlss = ( ws * Ll * 1i ) + RLl ;
Lm = 996.2e-6 ;
Zmss = ( ws * Lm * 1i ) ;
Cdc = 161.466e-6 ;
RCdc = 20e3 ;
Zdcss = RCdc ;
Rload = 500e3 ; % 128.94 ;
Vbat = 730 ;
Rbat = 0.045 ;
Kp1ss = ( Zmss + Zpsss + Zlss ) / Zmss ;
Kp2ss = Zpsss + Zlss ;
Kp3ss = 1 + ( Zpss / Zppss ) + ( Zpss / ( Zpsss + Zlss ) ) ;
Kp4ss = Zpss / ( Zpsss + Zlss ) ;
Ko1ss = ( 1 / Zdcss ) + ( 1 / Rload ) ;
Ko2ss = 1 + ( Rbat / Rload ) ;
%% Steady State
Mi = 0.975 ;
Vtt = ( 2 * sqrt(3) / pi ) * Mi * Vm ;
thetad = 1.263077326 ;
Vdc = Vbat ;
Vd = ( 4 / pi ) * Vdc * ( cos( thetad ) - 1i * sin( thetad ) ) ;
Id = abs( ( Vtt - ( Vd * ( Kp1ss * Kp3ss - Kp4ss ) ) ) / ( Kp2ss * Kp3ss ) ) * ( cos( thetad ) - 1i * sin( thetad ) ) ;
for iterations = 1 : 1 : 10
Iout = ( 2 / pi ) * abs( Id ) ;
Idc = Iout ;
Vdc = ( Vbat + Idc * Rbat ) / ( 1 + Rbat / Rload ) ;
Vd = ( 4 / pi ) * Vdc * ( cos( thetad ) - 1i * sin( thetad ) ) ;
Id = abs( ( Vtt - ( Vd * ( Kp1ss * Kp3ss - Kp4ss ) ) ) / ( Kp2ss * Kp3ss ) ) * ( cos( thetad ) - 1i * sin( thetad ) ) ;
end
Pdc = Vdc * Idc ;
Rd = ( 8 / pi^2 ) * ( Vdc / Idc ) ;
Vtest = 339.254 ;
%% Small Signal
syms s H_mi_thetadcap H_mi_vtest real
mi = Mi ;
vtt = ( 2 * sqrt(3) / pi ) * mi * Vm ;
Zp = ( s * Lp ) + ( ws * Lp * 1i ) + RLp ;
Zpp = RCpp / ( 1 + ( s * Cpp * RCpp ) + ( ws * Cpp * 1i * RCpp ) ) ;
Zps = RCps / ( 1 + ( s * Cps * RCps ) + ( ws * Cps * 1i * RCps ) ) ;
Zl = ( s * Ll ) + ( ws * Ll * 1i ) + RLl ;
Zm = ( s * Lm ) + ( ws * Lm * 1i ) ;
Zdc = RCdc / ( 1 + ( s * RCdc * Cdc ) ) ;
Kp1 = ( Zm + Zps + Zl ) / Zm ;
Kp2 = Zps + Zl ;
Kp3 = 1 + ( Zp / Zpp ) + ( Zp / ( Zps + Zl ) ) ;
Kp4 = Zp / ( Zps + Zl ) ;
Ko1 = ( 1 / Zdc ) + ( 1 / Rload ) ;
Ko2 = 1 + ( Rbat / Rload ) ;
H_mi_idcap_V = ( ( 4 * sqrt(3) * Vtest ) + ( 4 * sqrt(3) * Mi * H_mi_vtest ) + ( 1i * Vdc * 4 * ( Kp1 * Kp3 - Kp4 ) * ( cos( thetad ) - 1i * sin( thetad ) ) * H_mi_thetadcap ) ) / ( pi * Kp2 * Kp3 ) ;
H_mi_idcap_real = real( H_mi_idcap_V ) ;
H_mi_idcap_imag = imag( H_mi_idcap_V ) ;
Id_real = real( Id ) ;
Id_imag = imag( Id ) ;
Id_abs = abs( Id ) ;
equation_one = H_mi_thetadcap + ( ( H_mi_idcap_imag * Id_real ) - ( H_mi_idcap_real * Id_imag ) ) / Id_abs^2 ;
equation_two = H_mi_idcap_real - ( ( -Id_imag / Id_real ) * H_mi_idcap_imag ) ;
solution = solve( [equation_one, equation_two], [H_mi_thetadcap, H_mi_vtest] )
H_mi_thetadcap = getfield( solution, 'H_mi_thetadcap' )
H_mi_vtest = getfield( solution, 'H_mi_vtest' )
0 Comments
Accepted Answer
Dinesh
on 7 Jun 2023
Hi
The warning: unable to find explicit solution is because your equation is too complicated to solve. One way to solve this question would be to use numerical approach (vpasolve or fsolve).
Please refer to the following MATLAB documentations.
Also refer to this MATLAB answer thread for more details on solving two equations with two unknowns.
Hope this helps,
Thank you!
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!