Empty sym: 0-by-1 for a system of equations

1 Ansicht (letzte 30 Tage)
user3490
user3490 am 17 Jun. 2022
Beantwortet: Divyam am 11 Jun. 2025
The following system of equations assumes symbolic variables for all the terms. All the terms are assumed to be known values except for the parameter Iout. The objective is to find the parameter Iout in terms of all the other symbolic terms. The returned solution is shown below. Any feedback is appreciated.
syms Vin Iin Vout Iout Ip Is
syms ZL1 ZC1 ZC2 ZLP ZLS ZC3 ZC4 ZL2
syms w M
Z = [ZL1+ZC1, -ZC1, 0, 0;
-ZC1, ZC1+ZC2+ZLP, -1j*w*M, 0;
0, -1j*w*M, ZLS+ZC3+ZC4, -ZC4;
0, 0, -ZC4, ZC4+ZL2;];
I = [Iin; Ip; Is; Iout;];
V = [Vin; 0; 0; -Vout;];
solve(Z*I==V,Iout)
ans = Empty sym: 0-by-1
  2 Kommentare
David Goodmanson
David Goodmanson am 17 Jun. 2022
Hi RN,
you have four equations, one for each row of z*I = V, and one unknown. So, no solution. If you use
s = solve(Z*I==V,Iout,Iin,Ip,Is)
then Iin, for example, is a linear combination of Vin and Vout, and same for the other three currents. The expression for Iin has 984 characters which is pretty typical for a sym solution.
user3490
user3490 am 18 Jun. 2022
David,
Thanks for your prompt response!

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Divyam
Divyam am 11 Jun. 2025
MATLAB cannot isolate a single unknown in a system of equations unless it can reduce the system directly in terms of that variable. Since the equation involves a matrix-vector product, it needs to solve all variables first. To do so you just need to solve the whole system using the code below:
sol = solve(Z*I == V, [Iin, Ip, Is, Iout]);
You can also use the "linsolve" function for your use case since it has a better performance when to "solve" for numeric and symbolic linear systems. Here is some sample code to help you with using "linsolve":
vars = [Iin; Ip; Is; Iout];
sol_vec = linsolve(Z, V);
Iout_sol = sol_vec(4);
For more information regarding "linsolve" refer to the following documentation: https://www.mathworks.com/help/matlab/ref/linsolve.html

Tags

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by