MATLAB: Don’t graphics appear for this code

m-file

Why don't graphics appear for this code?
% Variáveis
m = 112.34;
temp = 25;
ISC = 7.8;
VTR = 0.0257;
VT = 0.0257;
VCA = 32.7;
GR = 1000;
G = 700;
% Cálculo do IR
IR = 1000 * (ISC / (2.718*exp(VCA/(m*VTR))-1))
for V = 0:1:VCA
V1 = V*2
%Carcular a potencia máxima para G=1000
P = V1*IR*35
end
figure(1)
h=plot(V1,P);
set(h,'color',rand(1,3),'linewidth',2);
hold on
axis([0 200 0 40])
xlabel('Tensão')
ylabel('Potência')
title('Curva P-V')

Best Answer

Each time through the loop you replace V1 and P, so at the end of the loop you only have a single point to plot.
Try
V1 = (0:1:VCA).*2; P = V1.*IR.*35;
with no loop.