Effacer les filtres
Effacer les filtres

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 vue (au cours des 30 derniers jours)
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
Error using fsolve
The input to FSOLVE should be either a structure with valid fields or consist of at least two arguments.
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

Réponse acceptée

Matt J
Matt J le 14 Mar 2023
Modifié(e) : Matt J le 14 Mar 2023
Perhaps as follows,
V=((1:330)-1)*0.1;
y=nan(size(V));
for i = 1:numel(V)
fhandle = @(I) I -Is*(1-kref.^((V(i)-Vo+Rs*I)/Voc));
y(i)= fzero(fhandle, Is);
end
plot(V,y),grid,
xlabel('Voltage'),ylabel('Current');

Plus de réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by