필터 지우기
필터 지우기

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

조회 수: 1 (최근 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 CenterFile Exchange에서 Power and Energy Systems에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by