Borrar filtros
Borrar filtros

Error with solve function

2 visualizaciones (últimos 30 días)
Maria Sarcos
Maria Sarcos el 23 de Oct. de 2020
Movida: VBBV el 20 de Jun. de 2023
I'm trying to solve these equations and find I1,I2,I3 but when I run it it gives me an error
syms I1 I2 I3
eqn1 = I1*(R_s + X_s) + I3*X_m == V1;
eqn2 = (I2*(X_r + R_r + Z1))/(I3*X_m) == 0;
eqn3 = I1 + I3 - I2 == 0;
S = solve([eqn1,eqn2,eqn3],[I2,I2,I3]);
I1sol = S.I1;
I2sol = S.I2;
I3sol = S.I3;
  1 comentario
VBBV
VBBV el 18 de Jun. de 2023
Movida: VBBV el 20 de Jun. de 2023
@Maria Sarcos, It seems you are using the same variable I2 twice to solve the equations. See @Ameer Hamza answer where he used all three variables
syms I1 I2 I3 R_s X_s X_m V1 X_r R_r Z1
eqn1 = I1.*(R_s + X_s) + I3.*X_m == V1;
eqn2 = (I2.*(X_r + R_r + Z1))./(I3*X_m) == 0;
eqn3 = I1 + I3 - I2 == 0;
% ------------------------->> use I1 in place of I2
S = solve([eqn1,eqn2,eqn3],[I1,I2,I3]);
I1sol = S.I1
I1sol = 
I2sol = S.I2
I2sol = 
0
I3sol = S.I3
I3sol = 

Iniciar sesión para comentar.

Respuestas (1)

Ameer Hamza
Ameer Hamza el 23 de Oct. de 2020
You also need to define other variables as symbolic
syms I1 I2 I3 R_s X_s X_m V1 X_r R_r Z1
eqn1 = I1*(R_s + X_s) + I3*X_m == V1;
eqn2 = (I2*(X_r + R_r + Z1))/(I3*X_m) == 0;
eqn3 = I1 + I3 - I2 == 0;
S = solve([eqn1,eqn2,eqn3],[I1,I2,I3]);
I1sol = S.I1;
I2sol = S.I2;
I3sol = S.I3;
  3 comentarios
Ameer Hamza
Ameer Hamza el 23 de Oct. de 2020
What is the error? Which numbers are imaginary?
Maria Sarcos
Maria Sarcos el 23 de Oct. de 2020
Error using sym.getEqnsVars>checkVariables (line 87)
Second argument must be a vector of symbolic variables.
Error in sym.getEqnsVars (line 54)
checkVariables(vars);
Error in solve>getEqns (line 429)
[eqns, vars] = sym.getEqnsVars(argv{:});
Error in solve (line 226)
[eqns,vars,options] = getEqns(varargin{:});
Error in Elektro (line 35)
S = solve([eqn1,eqn2,eqn3],[I2,I2,I3]);
X_s,X_m,X_r these variables have imaginary numbers

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by