Using symbolic solver, I seem to not be able to get a system of equations that give me a desired answer. Does a solution not exist?

1 visualización (últimos 30 días)
syms V1 V2 Vp Vn Vxp Vxn Vpx Vnx
syms Rp Rx Rn positive
Ison=((Vp/((Rp*68220)/(Rp+68220)))-(Vxp/((Rx*68220)/(Rx+68220))));
equ1=Vp==(V1+V2)-Ison*Rn;
Isop=((Vn/((Rn*68220)/(Rn+68220)))-(Vxn/((Rx*68220)/(Rx+68220))));
equ2=Vn==(V1+V2)-Isop*Rp;
Isox=((Vnx/((Rn*68220)/(Rn+68220)))-(Vpx/((Rp*68220)/(Rp+68220))));
equ3= Vpx==V1+Rx*Isox;
[Rn, Rp, Rx] = solve([equ1, equ2,equ3],[Rn , Rp, Rx]);
Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
simplify(Rn)
ans = 
simplify(Rp)
ans = 
simplify(Rx)
ans = 
Rn=vpa(subs(Rn,{V1,V2,Vp,Vn,Vxp,Vxn,Vpx,Vnx},{270,270,144.56868,147.38892,125.43132,122.61108,268.58987,271.41013}))
Rn = 
0.000044531163809619033020191303948558
Rp=vpa(subs(Rp,{V1,V2,Vp,Vn,Vxp,Vxn,Vpx,Vnx},{270,270,144.56868,147.38892,125.43132,122.61108,268.58987,271.41013}))
Rp = 
0.000044531163809288526802731288836632
Rx=vpa(subs(Rx,{V1,V2,Vp,Vn,Vxp,Vxn,Vpx,Vnx},{270,270,144.56868,147.38892,125.43132,122.61108,268.58987,271.41013}))
Rx = 
So I am trying to find values for Rn,Rx and Rp. I have three equations and three unknowns. When I use solve to find symbolic equation, I get equations for each variable. But when I sub real values in, I get an answer that is wrong or doesnt make sense. Adding assume doesnt seem to change anything and the return conditions is the same as the equations. The real values of Rn, Rp and Rx should be 2e6,1.5e6 and 700k. If you were to put these values in the original equations, you can verify that these values are correct. How do I get a system of equations that will give me the desired answer?

Respuestas (2)

Walter Roberson
Walter Roberson el 29 de Ag. de 2024
Movida: Walter Roberson el 29 de Ag. de 2024
The real values of Rn, Rp and Rx should be 2e6,1.5e5 and 700k.
Those are inconsistent with the equations.
Rn = 2e6;
Rp = 1.5e5;
Rx = 700e3;
syms V1 V2 Vp Vn Vxp Vxn Vpx Vnx
Ison=((Vp/((Rp*68220)/(Rp+68220)))-(Vxp/((Rx*68220)/(Rx+68220))));
equ1=Vp==(V1+V2)-Ison*Rn;
Isop=((Vn/((Rn*68220)/(Rn+68220)))-(Vxn/((Rx*68220)/(Rx+68220))));
equ2=Vn==(V1+V2)-Isop*Rp;
Isox=((Vnx/((Rn*68220)/(Rn+68220)))-(Vpx/((Rp*68220)/(Rp+68220))));
equ3= Vpx==V1+Rx*Isox;
eqns = [equ1; equ2; equ3]
eqns = 
sol = subs(eqns, {V1,V2,Vp,Vn,Vxp,Vxn,Vpx,Vnx}, {270,270,144.56868,147.38892,125.43132,122.61108,268.58987,271.41013})
sol = 
vpa(lhs(sol) - rhs(sol))
ans = 
%above should be quite close to zero if the equations are consistent.
  7 comentarios
Walter Roberson
Walter Roberson el 3 de Sept. de 2024
Under the hypothesis that perhaps Rn Rp Rx are incorrect:
Q = @(v) sym(v);
syms Rn Rp Rx
%Rn = Q(2e6);
%Rp = Q(1.5e6);
%Rx = Q(700e3);
syms V1 V2 Vp Vn Vxp Vxn Vpx Vnx
C = Q(68220);
Ison=((Vp/((Rp*C)/(Rp+C)))-(Vxp/((Rx*C)/(Rx+C))));
equ1=Vp==(V1+V2)-Ison*Rn;
Isop=((Vn/((Rn*C)/(Rn+C)))-(Vxn/((Rx*C)/(Rx+C))));
equ2=Vn==(V1+V2)-Isop*Rp;
Isox=((Vnx/((Rn*C)/(Rn+C)))-(Vpx/((Rp*C)/(Rp+C))));
equ3= Vpx==V1+Rx*Isox;
eqns = [equ1; equ2; equ3];
sol = subs(eqns, {V1,V2,Vp,Vn,Vxp,Vxn,Vpx,Vnx}, {270,270,144.56868,147.38892,125.43132,122.61108,268.58987,271.41013});
temp = lhs(sol) - rhs(sol)
temp = 
sol_Rn = solve(temp(1), Rn)
sol_Rn = 
temp2 = simplify(subs(temp(2:end), Rn, sol_Rn))
temp2 = 
sol_Rp = solve(temp2(1), Rp)
Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
sol_Rp = 
temp3 = simplify(subs(temp2(2:end), Rp, sol_Rp))
temp3 = 
sol_Rx = solve(temp3, Rx)
sol_Rx = 
back_Rx = sol_Rx
back_Rx = 
back_Rp = subs(sol_Rp, Rx, back_Rx)
back_Rp = 
back_Rn = subs(subs(sol_Rn, Rx, back_Rx), Rp, back_Rp)
back_Rn = 
subs(temp, [Rn, Rp, Rx], [back_Rn, back_Rp, back_Rx])
ans = 
Notice that Rx is negative.
Walter Roberson
Walter Roberson el 3 de Sept. de 2024
We must conclude one of a few possibilities:
  • that the equations are correct, but that resistance is indeed negative in the system; OR
  • that the equations are wrong; OR
  • that 270, 270, 144.56868 is inaccurate coefficients and the inaccuracies are significant
Your coefficients might be accurate to 5 significant digits, but that isn't good enough.

Iniciar sesión para comentar.


Torsten
Torsten el 29 de Ag. de 2024
Editada: Torsten el 29 de Ag. de 2024
It's the same situation as in your other problem:
Your system of equations has a unique solution, but this solution has not all components positive.
Your estimated values of Rn, Rp and Rx as 2e6,1.5e6 and 700k are not bad, but they cannot be true solutions because your system only has one unique solution:
Rn = 2e6;
Rp = 1.5e6;
Rx = 700e3;
syms V1 V2 Vp Vn Vxp Vxn Vpx Vnx
Ison=((Vp/((Rp*68220)/(Rp+68220)))-(Vxp/((Rx*68220)/(Rx+68220))));
equ1=Vp==(V1+V2)-Ison*Rn;
Isop=((Vn/((Rn*68220)/(Rn+68220)))-(Vxn/((Rx*68220)/(Rx+68220))));
equ2=Vn==(V1+V2)-Isop*Rp;
Isox=((Vnx/((Rn*68220)/(Rn+68220)))-(Vpx/((Rp*68220)/(Rp+68220))));
equ3= Vpx==V1+Rx*Isox;
eqns = [equ1; equ2; equ3]
eqns = 
sol = subs(eqns, {V1,V2,Vp,Vn,Vxp,Vxn,Vpx,Vnx}, {270,270,144.56868,147.38892,125.43132,122.61108,268.58987,271.41013})
sol = 
vpa(lhs(sol) - rhs(sol))
ans = 
  3 comentarios
Torsten
Torsten el 30 de Ag. de 2024
As long as your system has a unique solution, "solve" will report that solution. There is no way to tell MATLAB that you want the "second-best" values for the unknowns, but in a range of your choice.
Taiji
Taiji el 3 de Sept. de 2024
Does this mean the system is not defined properly? If I was to add more equations to the system, would I get a more accurate answer?

Iniciar sesión para comentar.

Etiquetas

Productos


Versión

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by