function [r2, Comp] = Compare(data)
% using sample time 1 for both sensors to verify measurments are similar

Comp = figure;

tl = tiledlayout('flow');
title(tl, 'Exploring mfet and nano Vrse')

nexttile
plot(data.SampTime1,data.Vrse1)
hold on
plot(data.SampTime1,data.Vrse2)
title('mfet vs nano Vrse')
legend('mfet','nano','Location','best')

nexttile
plot(data.SampTime1,data.Vrse1-mean(data.Vrse1))
hold on
plot(data.SampTime1,data.Vrse2-mean(data.Vrse2))
title('mfet vs nano Vrse (mean removed)')
legend('mfet','nano','Location','best')

corr = corrcoef(data.Vrse1-mean(data.Vrse1),...
    data.Vrse2-mean(data.Vrse2)); % r is correlation coefficient

r2 = corr(1,2).^2; %R-squared (R²) is a statistical measure that indicates
% how much of the variance of a dependent variable is explained by 
% an independent variable in a regression model

r2 = ['r^2 is ', num2str(r2)];
end