Hi
I want to use the function fzero for modeling PV Cell, but i have a problem about the line (I=fzero(fun,I0))
they display me : Error in fzero

2 件のコメント

Walter Roberson
Walter Roberson 2021 年 2 月 16 日
Not enough information to go on. We need your code to test with.
Manal KOUIHI
Manal KOUIHI 2021 年 2 月 16 日
Thanks for your answer,

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

 採用された回答

Walter Roberson
Walter Roberson 2021 年 2 月 16 日

0 投票

You should not have named your function fzero.m -- doing that interferes with calling the MATLAB fzero function.

2 件のコメント

Manal KOUIHI
Manal KOUIHI 2021 年 2 月 16 日
This is my code
clear all
k =1.8065e-23; %boltzman constant
q=1.602e-19; %charge of electron
Iscn=8.21; %Nominal SC Current
Vocn=35; %Nominal OC Voltage
kv=-0.1230; %Temperature voltage constant
Ki=0.0032; %Temperature current constant
Ns=54; %No.of series connected cells
T=25+273; %Opreating temperature
Tn=25+273; %Nominal temperature
Gn=1000; %Nominal Irradiance
a=1.3; %diode Ideality constant
Eg=1.12; %Band gap of silicon at 25 degree celcius
G=1000; %actual Irradiation
Rs=0.221;
Rp=415.405;
%Reverse saturation current
Vtn=Ns*(k*T/q);
Ion=Iscn/((exp(Vocn/(a*Vtn)))-1)
%Saturation current
Io=Ion*((Tn/T)^3)*exp(((q*Eg/a*k))*((1/Tn)-(1/T)));
%Photo current
Ipvn=Iscn;
Ipv=(Ipvn+Ki*(T-Tn))*(G/Gn);
Vt=Ns*(k*Tn/q);
%The current output of PV moduleThe current output of PV module
I0=5;
fun = @(I)(I-(Ipv- Io*(exp((V+(I*Rs))/(Vt*a))-1))-((V+(Rs*I)/Rp)));
I= fzero(fun,I0)
hold on
figure (1)
plot(V,I);
Walter Roberson
Walter Roberson 2021 年 2 月 18 日
Your code never assigns to V, but uses it in fun() and also uses it in plot()
Note that fzero() can only output a scalar in any one call, so your I would be a scalar if the all works. Also, the function you pass to fzero() must return a scalar. Your function uses all of V in a way that the output is going to be the same size as V, so your V would have to be a scalar too.
Then you get down to plot(V,I) but both of them are scalars. When you plot() a scalar, no line will be generated, and if you do not specify a marker, no marker will be drawn either.
My guess is that you want something like:
V = linspace(-5, 10);
funV = @(I,v)(I-(Ipv- Io*(exp((V+(I*Rs))/(Vt*a))-1))-((v+(Rs*I)/Rp)));
I = arrayfun(@(v) fzero(@(I) funV(I,v), I0), V);
plot(V, I)

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

その他の回答 (1 件)

Manal KOUIHI
Manal KOUIHI 2021 年 2 月 16 日

0 投票

I changed the name of the file but still same problem

カテゴリ

ヘルプ センター および File Exchange で Get Started with MATLAB についてさらに検索

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by