I have the error Attempted to access Irs(1.21516); index must be a positive integer or logical.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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.
Respuestas (1)
Steven Lord
el 30 de Mayo de 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.
0 comentarios
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!