% Script implemented by Francois Grosjean (OUFTI-2)
% Different plots of the IV characteristic of a 26.64 cm^2 UTJ cell 

function plotCell(G,TaC)
%close all
% Plots the IV characteristic of a solar panel of OUFTI-2
% i.e. two solar cells of 23.64 cm^2 in series

vmax=3;% Maximum voltage of the curve
%Resolution of the curve :
V=0:0.005:vmax;
I = Cell_UJT(V,G,TaC);
Imax=max(I);
P=V.*I;
Pmax=max(P);

figure 
V=2.*V;
P=V.*I;
[Pmax,Index]=max(P);
VMPP=V(Index);

str = sprintf('in series at %d°C and under a %1.1f W/m^2 insolation', TaC, G*1367);
title({'I-V and P-V curves of two 26.62 cm^2 Spectrolab UTJ cells',str})
grid on
yyaxis left
plot(V,I,'-b')
ylim([0 1.5*Imax])
ylabel('Current [A]')
yyaxis right
plot(V,P)
ylim([0 1.1*Pmax])
ylabel('Power [W]')
xlim([0 2*vmax])
xlabel('Voltage [V]')

end