load("lrauv-gliderfet-analysis_02.mat");
%%
vrse = gliderFET.Vrse.value;
vrsetime = gliderFET.Vrse.time;
depth = DepthKeller33X.depth.value;
depthtime = DepthKeller33X.depth.time;
%%
% Extract variables
vrse = gliderFET.Vrse.value;
vrse_time = gliderFET.Vrse.time;
depth = DepthKeller33X.depth.value;
depth_time = DepthKeller33X.depth.time;

% Choose a common time grid: union of both time arrays (or use linspace/min:max)
common_time = unique([vrse_time(:); depth_time(:)]);  % Sorted + unique

% Interpolate onto the common time grid
vrse_interp = interp1(vrse_time, vrse, common_time, 'linear', 'extrap');
depth_interp = interp1(depth_time, depth, common_time, 'linear', 'extrap');

% Plot for visual check
figure;
yyaxis left
plot(common_time, vrse_interp, '-b');
ylabel('Vrse (V)');

yyaxis right
plot(common_time, depth_interp, '-r');
ylabel('Depth (m)');

xlabel('Time');
title('Vrse and Depth Interpolated on Common Time Grid');
legend('Vrse', 'Depth');
%%
scatter(vrse_interp,depth_interp)