%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %drift_corr.m %This function calculates the drift in the gravimeter from day to day and %from morning to evening, and returns corrected gravity values. %input: gravity values, times (day, hour, minute), and data matrix of %measurements done in the basecamp in each day's morning and evening. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function g_drift_corr = drift_corr (g, day, hour, minute, base_camp_data_matrix) base_camp_g = base_camp_data_matrix(:, 2); base_camp_hour = base_camp_data_matrix(:, 3); base_camp_min = base_camp_data_matrix(:, 4) + base_camp_hour.*60; % %calculate the drift per minute within each day and the drift between days % for d= 1:(length(base_camp_data_matrix(:,1)))/2 day_corr(d) = base_camp_g(d*2-1) - base_camp_g(1); slope(d) = (base_camp_g(d*2) - base_camp_g(d*2-1)) ./ ( (base_camp_min(d*2)-base_camp_min(d*2-1))); end % %calculate the minute within a day from each station % minute_on_day = (hour.*60 + minute) - base_camp_min(day.*2-1); % %calculate the corrected gravity using the day's slope and day-to-day change % g_drift_corr = g - slope(day)'.*minute_on_day + day_corr(day)'; g_drift_corr = g ;