MATLAB: Integration of acceleration signal for complex modulus calculation

MATLABstress strain viscoelastic acceleration

Hi everyone,
i need some advice to determine the complex modulus (storage modulus and loss modulus) of a viscoelastic dampening element. I made an experiment with a dampened mass on a electro dynamic exciter and mesured the input (not dampened) and output (dampened) acceleration.
I have the following plan to calculate the complex modulus:
  1. The first step would be to get the displacement of the vibrating mass by integration
  2. And from there calculate the stress σ and strain ε in the dampening element.
  3. Then I would need the phase between stress and strain to calculate the complex modulus:
I made a script but the problem is, that the displacment increases with time. I expect the displacement to be sinusoidal and avereging around 0.
Regarding the other steps I'm not quite shure if I'm on the right path. I included some test data in a txt.zip. I had to shorten it due to size restrictions.
Your help is greatly appreciated
[FileNameXLS,FilePath] = uigetfile('*.txt','Select One or More Files','MultiSelect', 'on');
TotalFileName = string(fullfile(FilePath,FileNameXLS));
clear Time ACC;
T = readtable(TotalFileName);
%%


ACC = T{:,3}; % output[m/s^2)
Time = T{:,1}; % [s]
%%
%Find the beginning of the sweep with acc 1*g
ind_start = (1:find(ACC>9.8,1))';
ACC(ind_start) =[];
Time(ind_start) =[];
%find where the acc is 0 "clean start"
ind_z = (1:find(ACC<=0.1,1))';
ACC(ind_z) =[];
Time(ind_z) =[];
%%
vel0 = 0;
pos0 = 0;
VEL = vel0 + cumtrapz(Time,ACC);
POS = pos0 + cumtrapz(Time,VEL);
figure(1)
plot(Time,ACC,Time,VEL,Time,POS);
legend('ACC','VEL','POS')
This is the figure i get with the entire signal (1000s). I included a shorter signal due to it being to large of a file. As you can see the POS (displacement) takes of and that doesn't make any sense.
%---further steps----
mass = 0.1535; %[kg]
crossSect = (1-0.116)*((pi*(0.023^2))/4); %Cross section of the element. [m^2]
%sigma_0:stress
%epsilon_0:strain
%phi: phaselag between stress and strain
%sigma_0 = (ACC*mass)/crossSect; %stress
%epsilon_0 = ?
%storage mod E' = (sigma_0/epsilon_0)*cos(phi)
%loss mod E'' = (sigma_0/epsilon_0)*sin(phi)

Best Answer

My guess is that the first integration is also creating a constant of integration, and that would show up as a constant offset that could be eliminated by subtracting the mean of the acceleration and the mean of the velocity from the respective integrations.
Try this:
VEL_1 = vel0 + cumtrapz(Time,ACC-mean(ACC));
POS_1 = pos0 + cumtrapz(Time,VEL-mean(VEL));
That creates an acceptable result and has a logical mathematical basis (at least in my opinion). I cannot determine if it actually solves the problem, so I leave that determination to you, and this approach for you to experiment with.