フィルターのクリア

I have the error Attempted to access Irs(1.21516); index must be a positive integer or logical.

1 回表示 (過去 30 日間)
shrik kader
shrik kader 2017 年 5 月 30 日
回答済み: Steven Lord 2017 年 5 月 30 日
while the code is
clc
close all
Gref = 1000; %reference irradiance
Tcref=25+273; % reference temperature in Kelvin
Tc=45+273; % opertion temperature in Kelvin
G=800; % operation irradiance
Rs=0.39383;
vocref=36.3;
Eg=1.12; % band gap of material
Iscref=7.84;
A=0.98117; % ideality factor of diode
q = 1.6e-19;
k = 1.38e-23;
Ns=60;
Ki=0.102;
Ipv=(G/Gref)*(Iscref+Ki*(Tc-Tcref));
vtn=(A*k*Tcref*Ns)/q;
Irs= Iscref/(exp(vocref/(A*vtn))-1);
Io= Irs((Tc/Tcref)^3)*exp(((Eg*q)/(A*K))*((1/Tcref)-(1/Tc)));
Id=Io(exp((q*(v+I*Rs)/(A*K*Tc*Ns))-1));
i = 0; % Set initial current
x=1;
I = zeros(1,30);
for v=0:0.005:36.3
I(x)= Ipv - Io*(exp((q*(v+i*Rs)/(A*K*Tc*Ns))-1)) - ((v+Rs)/Rsh);
i = I(x) %Update Current
x=x+1;
end
v=0:0.005:36.3;
P = I.*v;
plot(v,P)
grid on
what should I do ?. P.S: I am still beginner.
  3 件のコメント
shrik kader
shrik kader 2017 年 5 月 30 日
Stephen Cobeldick, As I said I am beginner, what do you suggest to do ?
Stephen23
Stephen23 2017 年 5 月 30 日
編集済み: Stephen23 2017 年 5 月 30 日
@shrik kader: I don't know what your algorithm is, so unless you describe exactly what you are trying to achieve, I can only guess. My guess is that you might need interpolation of your data:

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

回答 (1 件)

Steven Lord
Steven Lord 2017 年 5 月 30 日
If on this line of code:
Io= Irs((Tc/Tcref)^3)*exp(((Eg*q)/(A*K))*((1/Tcref)-(1/Tc)));
you're attempting to multiply Irs by ((Tc/Tcref)^3) and multiply the result by the exponential of another quantity, you're missing the first multiplication.
Io= Irs*((Tc/Tcref)^3)*exp(((Eg*q)/(A*K))*((1/Tcref)-(1/Tc)));
If instead you have a vector Irs containing data and an associated "index" vector and want to interpolate the Irs vector to obtain data at some point that is not present in the "index" vector, as Stephen said you will need to interpolate.

カテゴリ

Help Center および File ExchangePower and Energy Systems についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by