%% This script is for loading the diode data in, running the fits, and plotting the
% values of I0 against the temperatures.

MJR_diode_12_03_100k = load('MJR_diode_12_03_100k.txt');
v100 = MJR_diode_12_03_100k(:,1);
i100 = MJR_diode_12_03_100k(:,2);

MJR_diode_12_03_125k = load('MJR_diode_12_03_125k.txt');
v125 = MJR_diode_12_03_125k(:,1);
i125 = MJR_diode_12_03_125k(:,2);

MJR_diode_12_03_150k = load('MJR_diode_12_03_150k.txt');
v150 = MJR_diode_12_03_150k(:,1);
i150 = MJR_diode_12_03_150k(:,2);

MJR_diode_12_03_175k = load('MJR_diode_12_03_175k.txt');
v175 = MJR_diode_12_03_175k(:,1);
i175 = MJR_diode_12_03_175k(:,2);

MJR_diode_12_03_200k = load('MJR_diode_12_03_200k.txt');
v200 = MJR_diode_12_03_200k(:,1);
i200 = MJR_diode_12_03_200k(:,2);


% MJR_diode_12_03_250k = load('MJR_diode_12_03_250k.txt');
% v250 = MJR_diode_12_03_250k(:,1);
% i250 = MJR_diode_12_03_250k(:,2);

MJR_diode_12_03_296k = load('MJR_diode_12_03_296k.txt');
v296 = MJR_diode_12_03_296k(:,1);
i296 = MJR_diode_12_03_296k(:,2);

% va = [v100 v125 v150 v175 v200 v250 v296];
% i = [i100 i125 i150 i175 i200 i250 i296];
% Tvec = [100 125 150 175 200 250 296];

va = {v100, v125, v150, v175, v200, v296};
i = {i100, i125, i150, i175, i200, i296};
Tvec = [100 125 150 175 200 296];

% x = []; y = []; z = [];
I0vec = [];

for w = 1:length(Tvec)
    [x,y,z] = MJRfitd(cell2mat(va(w)),cell2mat(i(w)),Tvec(w));
    I0vec = [I0vec z];
end
% figure
% plot(1./Tvec, I0vec,'.');
