I am trying to solve current equations of a pv cell using fsolve butit keeps showing error, can someone pls see what the error in my code is?
1 view (last 30 days)
Show older comments
Here is the main code:
clc;
clear all;
Pmpp = 50; %Max Power
Vmpp = 17.98; %Vol at Pmax
Impp = 2.77; %Current at Pmax
Isc= 3; %Short-circuit current
Voc= 22; %Open Circuit Voltage
a= 0.0004; %Temp coeff. of Isc
b= -0.0033; %Temp coeff. of Voc
T = 35;
Tref= 25;
S= 600;
Sref= 1000;
Rs= 0.085;
V= 30;
tic
kref= (1-(Impp/Isc))^(1/(((Vmpp+Rs*Impp)/Voc)-1));
Vo = Voc*(1+ a*log(S/Sref)+ b*(T-Tref));
I= zeros(330,1);
Is = Isc*(1+a*(T-Tref))*(S/Sref);
for i = 1:330
V(i)= (i-1)*0.1;
fhandle = @fun4bisec;
[I]= fsolve(@(I) fhandle(I,V(i)));
y(i)= I;
end
time_elapsed=toc;
plot(V,y),grid,hold on;
xlabel('Voltage'),ylabel('Current');
The code for function fun4bisec is:
function fval1= fun4bisec(Is,kref, Vo,Rs, Voc)
fval1= I(i) -Is*(1-kref.^((V(i)-Vo+Rs*I(i))/Voc));
end
2 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!