System of 4 non-linear equations yields Empty sym: 0-by-1

1 view (last 30 days)
I am trying to resolve a system of 4 non-linear (exponential) equations using vpasolve. The system reprensents the 4 equations needed to characterize the electrical model of a solar cell from the values given in datasheets (, and ). However, the solutions for the 4 desired values ( and ) are all "Empty sym: 0-by-1".
The equations forming the system are:
1)
2)
3)
4)
My code is
%parameters
I_sc = 0.473;
V_oc = 2.6;
V_m = 2.32;
I_m = 0.455;
R_s = 0.001;
T = 313.5;
k = 1.38e-23;
e = 1.6e-19;
c = 1;
g = k*T;
%unknowns : a = I_in, b = I_diode, c = gamma, d = R_sh
syms a b c d
eq1= a - b * (exp(e*(R_s*I_sc)/c*g)-1) - (1/d)*R_s*I_sc == I_sc;
eq2= a - b * (exp(e*(V_oc)/c*g)-1) - (1/d)*V_oc == 0;
eq3= a - b * (exp(e*(V_m + R_s*I_m)/c*g)-1) - (1/d)*(V_m + R_s*I_m) == I_m;
eq4= I_m + V_m * ((-b) * (e*exp(e*(V_m + R_s * I_m)/(c * g))/c * g) - (1/d)) == 0;
sol = vpasolve(eq1,eq2,eq3,eq4);
sol.a
sol.b
sol.c
sol.d
Is there no way to obtain values for this system of equation ? The value of can vary between 0 and 0.615.
Thanks

Answers (2)

Torsten
Torsten on 14 Jul 2022
%parameters
I_sc = 0.473;
V_oc = 2.6;
V_m = 2.32;
I_m = 0.455;
R_s = 0.001;
T = 313.5;
k = 1.38e-23;
e = 1.6e-19;
c = 1;
g = k*T;
%unknowns : a = I_in, b = I_diode, c = gamma, d = R_sh
fun = @(a,b,c,d)[a - b * exp(e*(R_s*I_sc)/(c*g)-1) - 1/d*R_s*I_sc - I_sc;...
a - b * exp(e*(V_oc)/(c*g)-1) - 1/d*V_oc;...
a - b * exp(e*(V_m + R_s*I_m)/(c*g)-1) - 1/d*(V_m + R_s*I_m) - I_m;...
I_m + V_m * (-b * e*exp(e*(V_m + R_s * I_m)/(c * g))/(c * g) - 1/d)];
x0 = [2 4 6 8];
options = optimset('MaxFunEvals',100000);
x = fsolve(@(x)fun(x(1),x(2),x(3),x(4)),x0,options)
Equation solved, inaccuracy possible. The vector of function values is near zero, as measured by the value of the function tolerance. However, the last step was ineffective.
x = 1×4
0.4730 0.0000 2.1996 167.6364
fun(x(1),x(2),x(3),x(4))
ans = 4×1
1.0e-14 * 0 -0.2930 -0.0056 -0.2442

Abderrahim. B
Abderrahim. B on 14 Jul 2022
Hi!
Make sure to recheck equations parentheses.
clear
% parameters
I_sc = 0.473;
V_oc = 2.6;
V_m = 2.32;
I_m = 0.455;
R_s = 0.001;
T = 313.5;
k = 1.38e-23;
e = 1.6e-19;
c = 1;
g = k*T;
% unknowns : a = I_in, b = I_diode, c = gamma, d = R_sh
syms a b c d
eq1 = a - b * exp((e*(R_s*I_sc)/(c*g))-1) - (1/d)*R_s*I_sc == I_sc;
eq2 = a - b * exp((e*(V_oc)/(c*g))-1) - (1/d)*V_oc == 0;
eq3 = a - b * exp((e*(V_m + R_s*I_m)/(c*g))-1) - (1/d)*(V_m + R_s*I_m) == I_m;
eq4 = I_m + V_m * ((-b * e* exp(e*(V_m + R_s * I_m)/(c*g))/(c * g) - (1/d))) == 0;
sol = vpasolve([eq1, eq2, eq3, eq4], [a, b, c,d]) ;
a = sol.a
a = 
b = sol.b
b = 
c = sol.c
c = 
d = sol.d
d = 
  3 Comments
Torsten
Torsten on 14 Jul 2022
4 equations for 3 unknown ? This yields no solution in general.
Abderrahim. B
Abderrahim. B on 14 Jul 2022
@Simon Kellen check @Torsten answer. In this case, you are like forcing you sys of eq to have more conditions than unknowns, you should expect that generically there are no solutions.

Sign in to comment.

Categories

Find more on Simulation, Tuning, and Visualization in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!