フィルターのクリア

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 回表示 (過去 30 日間)
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
  2 件のコメント
Matt J
Matt J 2023 年 3 月 14 日
No, we can't analyze your code unless we can run run it.
Aryan Sharma
Aryan Sharma 2023 年 3 月 14 日
I've edited it, can you pls check now

サインインしてコメントする。

採用された回答

Matt J
Matt J 2023 年 3 月 14 日
編集済み: Matt J 2023 年 3 月 14 日
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');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by