Matlab won't solve system of equations

24 views (last 30 days)
Tarek Sayed Hamad
Tarek Sayed Hamad on 25 Nov 2019
Answered: Swatantra Mahato on 8 Sep 2020
Hi!
I have been working on solving a system of equations symbolically using Matlab, but it won't return a value. I have 6 equations and 6 variables (solvable). I have even tried to simply this system of equations by hand, which gave me 2 equations and 2 unknown variables, but Matlab wouldn't solve that one either. I have the following code:
tau = 8.5; w_r = 1500*pi/30; p = 2; i_sn = 3.1; u_sn = 400*sqrt(2);
w_e = p*w_r; power = tau*w_r;
syms u_sq u_sd i_sq i_sd L_sq L_sd
eq1 = sqrt(w_e^2 * ((L_sd*i_sd)^2 + (L_sq*i_sq)^2)) == u_sn
eq2 = ((L_sd*i_sd)^2 + (L_sq*i_sq)^2) / (sqrt(w_e^2 * ((L_sd*i_sd)^2 + (L_sq*i_sq)^2))) == 0
eq3 = (3/2)*p*(L_sd - L_sq)*u_sd*u_sq/(w_e^2*L_sd*L_sq) == tau
eq4 = 3*p*u_sd*u_sq*(L_sd - L_sq)/(w_e^3*L_sd*L_sq) == 0
eq5 = i_sq*u_sq + i_sd*u_sd == power
eq6 = i_sq^2 + i_sd^2 == i_sn^2
eqs = [eq1, eq2, eq3, eq4, eq5, eq6];
solveFor = [u_sq, u_sd i_sq i_sd L_sq L_sd];
solution = solve(eqs, solveFor);
solutionL_sq = solution.L_sq
solutionL_sd = solution.L_sd
The results is:
solutionL_sq =
Empty sym: 0-by-1
solutionL_sd =
Empty sym: 0-by-1
Does anyone know what's wrong? I cannot seem to find this online.

Answers (1)

Swatantra Mahato
Swatantra Mahato on 8 Sep 2020
Hi,
You may want to recheck the system of equations you want to solve as I can see inconsistencies in eq1-2 and eq3-4
eq1 = sqrt(w_e^2 * ((L_sd*i_sd)^2 + (L_sq*i_sq)^2)) == u_sn
eq2 = ((L_sd*i_sd)^2 + (L_sq*i_sq)^2) / (sqrt(w_e^2 * ((L_sd*i_sd)^2 + (L_sq*i_sq)^2))) == 0
By combining the above equations we get
((L_sd*i_sd)^2 + (L_sq*i_sq)^2) == 0
Which when substituted back to eq1 gives
sqrt(w_e^2) == u_sn
which is incorrect.
Similarly, for eq3 and eq4 we get
2*tau/w_e == 0
which is again false.
Additionally, you can refer the documentation for tips on troubleshooting solve
Hope this helps

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!