Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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 Commenti
Stephen23
Stephen23 il 30 Mag 2017
Modificato: Stephen23 il 30 Mag 2017
@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:

Accedi per commentare.

Risposte (1)

Steven Lord
Steven Lord il 30 Mag 2017
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.

Categorie

Scopri di più su Power and Energy Systems in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by