MATLAB: Unable to find explicit solution for “solve”

solve

Code summary: Trying to calculate an array of 'Inet' values, one for every 'V' value. All of the other values are individul numbers. The code is below. The reason I believe it is not working is that there are 'Inet' variables on each side of the equation.
V = 0:.01:3;
syms Inet;
I = solve(Inet == Isc - Is.*(exp(q.*(V+Inet*Rs)./(n*kB*Tc))-1)-(V+Inet*Rs)./Rsh, Inet);
Here is the output warning:
Warning: Unable to find explicit solution. For options, see help.
After running the code, 'I' has no value. I would like it to be an array of 301 numbers, just like 'V'. Can anybody see what I'm doing wrong? Any help is appreciated

Best Answer

Hi,
solve numeric:
% Values for constants - I took some fantasy values...
Isc = 0.1;
Is = 1;
q = 2;
Rs = 0.0135;
Rsh = -2;
n = 4;
kB = 0.4;
Tc = 10;
% Definition of V as column vector
V = (0:.01:3)';
% Solve for Inet
x0 = ones(size(V,1),1);
Inet = fsolve(@(x)solve_Inet(x,Isc,Is,q,V,Rs,Rsh,n,kB,Tc),x0);
% Inet Function
function F = solve_Inet(x,Isc,Is,q,V,Rs,Rsh,n,kB,Tc)
Inet = x;
F = Isc - Is.*(exp(q.*(V+Inet*Rs)./(n*kB*Tc))-1)-(V+Inet*Rs)./Rsh - Inet;
end
Best regards
Stephan