disp(' ');
disp(' disp_correction.m  ver 1.0  July 12, 2012 ');
disp(' ');
disp('    by Tom Irvine ');
disp(' ');
%
disp(' This script corrects an acceleration signal so that its ');
disp(' corresponding velocity and displacement time histories ');
disp(' are stable and oscillate about the zero baseline. ');
disp(' ');
%
close all;
%
clear accel;
clear velox;
clear dispx;
%
clear accel_th;
clear velox_th;
clear dispx_th;
%
fig_num=1;
%
disp(' ');
disp(' Select units ');
disp('  1=English:        G, in/sec, in ');
disp('  2=English: in/sec^2, in/sec, in ');
disp('  3= Metric:  m/sec^2,  m/sec,  m ');
iu=input(' ');
%
[t,accel,dt,sr,tmx,tmi,n,ncontinue]=enter_time_history();
%
[t,accel,velox,dispx]=velox_correction_d(t,accel,dt);
%
if(iu==1)
    velox=velox*386;
    dispx=dispx*386;
end
%
if(iu==1)
   accel_label='G';
   velox_label='in/sec';
    disp_label='in';
end
if(iu==2)
   accel_label='in/sec^2';
   velox_label='in/sec';
    disp_label='in';
end
if(iu==3)
   accel_label='m/sec^2';
   velox_label='m/sec';
    disp_label='m';
end
accel_out=sprintf(' Accel (%s)',accel_label);
velox_out=sprintf(' Vel (%s)',velox_label);
 disp_out=sprintf(' Disp (%s)',disp_label);
%
[t]=fix_size(t);
[accel]=fix_size(accel);
[velox]=fix_size(velox);
[dispx]=fix_size(dispx);
%
accel_th=[t accel];
velox_th=[t velox];
disp_th =[t dispx];
%
figure(fig_num);
fig_num=fig_num+1;
plot(t,accel);
grid on;
xlabel('Time(sec) ');
ylabel(accel_out);
title('Corrected Acceleration');
%
figure(fig_num);
fig_num=fig_num+1;
plot(t,velox);
grid on;
xlabel('Time(sec) ');
ylabel(velox_out);
title('Corrected Velocity');
%
figure(fig_num);
fig_num=fig_num+1;
plot(t,dispx);
grid on;
xlabel('Time(sec) ');
ylabel(disp_out);
title('Corrected Displacement');
%
disp(' ');
disp(' Output Arrays ');
disp('   accel_th ');
disp('   velox_th ');
disp('   disp_th ');