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

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 commentaires

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 le 18 Juin 2022
David,
Thanks for your prompt response!

Connectez-vous pour commenter.

Réponses (1)

Divyam
Divyam le 11 Juin 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

Catégories

En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange

Produits

Version

R2020b

Tags

Question posée :

le 17 Juin 2022

Réponse apportée :

le 11 Juin 2025

Community Treasure Hunt

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

Start Hunting!

Translated by