 units of J/K
Tcell = 25; %deg C
q = 1.60217646E-19; %Electron charge in coulombs
nVth = n*Ns*k*(Tcell+273.15)/q;
NumPoints = 1000;
[IVResult] = pvl_singlediode(IL, I0, Rs, Rsh, nVth, NumPoints);

figure
plot(IVResult.V,IVResult.I)
hold on
scatter(IVResult.Vmp,IVResult.Imp,'filled')
xlabel('Voltage (V)')
ylabel('Current (A)')
title('Example IV Curve from Single Diode Model','FontSize',14)
Pmax = IVResult.Vmp*IVResult.Imp  %Max Power of Module
%% References:
%
% * [1] S.R. Wenham, M.A. Green