approximate derivate with difference for a discrete data in

时间:2020-12-27 17:47:21

backgound: post processing of VIV

goal:  to get y‘ and y‘‘

 

input data:

approximate derivate with difference for a discrete data in

output:

y‘ vs time, and y‘‘ vs time

 

Matlab code

1 clc;
2 clear;
3 data=xlsread(gap1Ur8.xlsx);
4 t=data(1000:2000,1);  % time
5 dt= 0.005;
6 y=data(1000:2000,2);      % displacement, 2nd column in the input data
7 der_y=diff(y)./dt;            % y=dy/dt, i.e. 1st derivative
8 der_y_2 = diff(der_y)./dt;    % y‘‘, i.e. 2nd derivative of y
9 plot( data(1002:2000,1), der_y_2, k,data(1001:2000,1), der_y,r,t, y, b);