Array indices must be positive integers or logical values.
Show older comments
I am trying to plot an I-V curve but I keep getting the same error
Isc = 8.7 % short circuit current
ns = 30
np = 40
n = 1.95 %Ideality factor
K0 = 0.0017
Tr = 300 % refrence temperature
Is = 1.2*10^-7 % diode reverse saturated current
q = 1.602*10^-19 % electron charge
K = 1.38*10^-23 %Boltzmann constant
Rs = 0.013
Rp = 3.5
% Part1 %
S_1 = 1000 % apparent power
T_1 = 233.15
Vpv = (0:0.01:1.2)
Ipv1 = zeros(length(T_1),length(Vpv))
Power1 = zeros(length(T_1),length(Vpv))
for k = 1:length(T_1)
Ipv1(k,:) = (np.*((Isc+K0.*(T_1(k)-Tr))./100).*S_1)-((np.*Is).*(exp(q.*Vpv)./(n.*K.*T(K).*ns))-1)-((np.*Vpv)./(ns.*Rp));
Vpv1 = Vpv.*ns;
f_1 = figure(1);
P1 = plot(Vpv1,Ipv1(k,:),'LineWidth',2.0);
grid on
hold on
title('Current vs Voltage Based on Changing Temperature');
ylabel('Current (A)');
xlable('Voltage (V)');
ylim([0,6000]);
ax = gca;
ax.FontSize = 10;
ax.FontName = 'Times New Roman';
legend('T = -40c','T = -20c','T =0c','T = 20c','T = 40c','T = 60c','Location','southwest');
end
Answers (1)
Sindar
on 25 Mar 2020
(n.*K.*T(K).*ns))
is that supposed to be T*K or T(k)?
1 Comment
Timothy Schackne
on 25 Mar 2020
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!