function [tFs_int,tFf_int,fFeq,nF,kF,nB,kB,gamma] = comp_nkfeqgamma(Tint,TF,TB,tFs_inp,TFs_inp,tFf_inp,TFf_inp,tBs_inp,TBs_inp,tBf_inp,TBf_inp,TFeq_inp_unique,fFeq_inp_unique,TMS,TMF,fFs,fFf,fBs,fBf,fMs,fMf)
% Compute n, k feq and gamma such that we can apply JMAK anf KM to compute
% the volume freactions of the phases that are formed during cooling down 
% interpolate the raw data over the the desired data points


%% interpolate the TTT data points over the desired data points
tFf_int = interp1(TFf_inp,tFf_inp,TF,'linear'); % interpolate the TTT data points over the desired data points
tFs_int = interp1(TFs_inp,tFs_inp,TF,'linear'); % interpolate the TTT data points over the desired data points
tBf_int = interp1(TBf_inp,tBf_inp,TB,'linear','extrap'); % interpolate the TTT data points over the desired data points
tBs_int = interp1(TBs_inp,tBs_inp,TB,'linear','extrap'); % interpolate the TTT data points over the desired data points
fFeq = interp1(TFeq_inp_unique,fFeq_inp_unique,Tint,'linear','extrap'); % interpolate the equilibrium volume fraction data points over the desired data points

% initialise vectors in which n and k values are stored for each
% temperature Tint
nF = zeros(1,length(Tint));
kF = zeros(1,length(Tint));
nB = zeros(1,length(Tint));
kB = zeros(1,length(Tint));

% Compute n, k for Ferrite
for i = 1: length(tFf_int)
nF(i) = log(log(1-fFs)/log(1-fFf))/log(tFs_int(i)/tFf_int(i));
kF(i) = -log(1-fFs)/(tFs_int(i)^(nF(i)));
end

% Compute n, k for Bainite
if TF(end) == TB(1) % so if TFF == TBS
for i = 1: length(tBf_int)
    % start computing the n and k where TF stops (at TBS)
nB(i+length(TF)-1) = log(log(1-fBs)/log(1-fBf))/log(tBs_int(i)/tBf_int(i));
kB(i+length(TF)-1) = -log(1-fBs)/(tBs_int(i)^(nB(i)));
end
else
 for i = 1: length(tBf_int)
    % start computing the n and k where TF stops (at TBS)
nB(i+length(TF)) = log(log(1-fBs)/log(1-fBf))/log(tBs_int(i)/tBf_int(i));
kB(i+length(TF)) = -log(1-fBs)/(tBs_int(i)^(nB(i)));
end   
end

% compute gamma for Martensite
gamma = -log((1-fMs)/(1-fMf))/(TMF-TMS);
end

