Skip to content

Commit 1e3bebb

Browse files
authored
Add files via upload
1 parent e064f11 commit 1e3bebb

File tree

5 files changed

+202
-0
lines changed

5 files changed

+202
-0
lines changed

CentDiff.m

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
function [y] = CentDiff(F,M,K,C,dt,x0,v0)
2+
% [y] = CentDiff(F,M,K,C,dt,x0,v0)solves numerically the equation of motion
3+
% of a damped system
4+
%
5+
%
6+
% INPUT
7+
% F : vector -- size: [1x N] -- Time series representinf the time history of the load.
8+
% M : scalar -- size: [1 x 1] -- Modal mass
9+
% K : scalar -- size: [1 x 1] -- Modal stifness
10+
% C : scalar -- size: [1 x 1] -- Modal damping
11+
% dt : scalar -- size: [1 x 1] -- time step
12+
% x0 : scalar -- size: [1 x 1] -- initial displacement
13+
% v0 : scalar -- size: [1 x 1] -- initial velocity
14+
%
15+
% OUTPUT
16+
% y: time history of the system response to the load
17+
%
18+
% author: E. Cheynet - UiB - last updated: 14-05-2020
19+
%
20+
21+
%%
22+
% Initialisation
23+
N = size(F,2);
24+
% preallocation
25+
y = zeros(size(F));
26+
27+
% initial acceleration
28+
a0 = M\(F(1)-C.*v0-K.*x0);
29+
% initialisation of y (first 2 values).
30+
y0 = x0-dt.*v0+dt^2/2*a0;
31+
y(:,1) = x0;
32+
A = (M./dt.^2+C./(2*dt));
33+
B = ((2*M./dt.^2-K).*y(:,1)+(C./(2*dt)-M./dt.^2).*y0+F(:,1));
34+
y(:,2) = A\B;
35+
36+
% For the rest of integration points
37+
for ii=2:N-1
38+
A = (M./dt.^2+C./(2*dt));
39+
B = ((2*M./dt.^2-K).*y(:,ii)+(C./(2*dt)-M./dt.^2).*y(:,ii-1)+F(:,ii));
40+
y(:,ii+1) = A\B;
41+
end
42+
43+
end
44+

Documentation.mlx

183 KB
Binary file not shown.

NExT.m

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
function [R,t] = NExT(y,dt,Ts,method)
2+
%
3+
% [R] = NExT(y,ys,T,dt) implements the Natural Excitation Technique to
4+
% retrieve the free-decay response (R) from the cross-correlation
5+
% of the measured output y.
6+
%
7+
%
8+
% Synthax
9+
%
10+
% [R] = NExT(y,dt,Ts,1) calculates R with cross-correlation
11+
% calculated by using the inverse fast fourier transform of the
12+
% cross-spectral power densities without zero-padding(method = 1).
13+
%
14+
% [R] = NExT(y,dt,Ts,2) calculate the R with cross-correlation
15+
% calculated by using the unbiased cross-covariance function (method = 2)
16+
%
17+
% Input
18+
% y: time series of ambient vibrations: vector of size [1xN]
19+
% dt : Time step
20+
% method: 1 or 2 for the computation of cross-correlation functions
21+
% T: Duration of subsegments (T<dt*(numel(y)-1))
22+
%
23+
% Output
24+
%
25+
% R: impusle response function
26+
% t: time vector asociated to R
27+
%
28+
% Author: E. Cheynet - UiB - last modified 14-05-2020
29+
30+
%%
31+
if nargin<4, method = 2; end % the fastest method is the default method
32+
if ~ismatrix(y), error('Error: y must be a vector or a matrix'),end
33+
34+
35+
[Nyy,N]=size(y);
36+
if Nyy>N
37+
y=y';
38+
[Nyy,N]=size(y);
39+
end
40+
41+
% get the maximal segment length fixed by T
42+
M = round(Ts/dt);
43+
switch method
44+
case 1
45+
clear R
46+
for ii=1:Nyy
47+
for jj=1:Nyy
48+
y1 = fft(y(ii,:));
49+
y2 = fft(y(jj,:));
50+
h0 = ifft(y1.*conj(y2));
51+
R(ii,jj,:) = h0(1:M);
52+
end
53+
end
54+
% get time vector t associated to the R
55+
t = linspace(0,dt.*(size(R,3)-1),size(R,3));
56+
if Nyy==1
57+
R = squeeze(R)'; % if Nyy=1
58+
end
59+
case 2
60+
R = zeros(Nyy,Nyy,M+1);
61+
for ii=1:Nyy
62+
for jj=1:Nyy
63+
[dummy,lag]=xcov(y(ii,:),y(jj,:),M,'unbiased');
64+
R(ii,jj,:) = dummy(end-round(numel(dummy)/2)+1:end);
65+
end
66+
end
67+
if Nyy==1
68+
R = squeeze(R)'; % if Nyy=1
69+
end
70+
% get time vector t associated to the R
71+
t = dt.*lag(end-round(numel(lag)/2)+1:end);
72+
end
73+
% normalize the R
74+
if Nyy==1
75+
R = R./R(1);
76+
else
77+
end
78+

RDT.m

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
function [R,t] = RDT(y,ys,T,dt)
2+
%
3+
% [R] = RDT(y,ys,T,dt) returns the free-decay response (R) by
4+
% using the random decrement technique (RDT) to the time serie y, with a
5+
% triggering value ys, and for a duration T
6+
%
7+
% INPUT:
8+
% y: time series of ambient vibrations: vector of size [1xN]
9+
% dt : Time step
10+
% ys: triggering values (ys < max(abs(y)) and here ys~=0)
11+
% T: Duration of subsegments (T<dt*(numel(y)-1))
12+
% OUTPUT:
13+
% R: impusle response function
14+
% t: time vector asociated to R
15+
%
16+
% Author: E. Cheynet - UiB - last modified 14-05-2020
17+
18+
%%
19+
20+
if T>=dt*(numel(y)-1)
21+
error('Error: subsegment length is too large');
22+
else
23+
% number of time step per block
24+
nT = round(T/dt); % sec
25+
end
26+
27+
if ys==0
28+
error('Error: ys must be different from zero')
29+
elseif or(ys >=max(y),ys <=min(y)),
30+
error('Error: ys must verifiy : min(y) < ys < max(y)')
31+
else
32+
% find triggering value
33+
ind=find(diff(y(1:end-nT)>ys)~=0)+1;
34+
35+
end
36+
37+
% construction of decay vibration
38+
R = zeros(numel(ind),nT);
39+
for ii=1:numel(ind)
40+
R(ii,:)=y(ind(ii):ind(ii)+nT-1);
41+
end
42+
43+
% averaging to remove the random part
44+
R = mean(R);
45+
% normalize the R
46+
R = R./R(1);
47+
% time vector corresponding to the R
48+
t = linspace(0,T,numel(R));
49+
end
50+

expoFit.m

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
function [zeta] = expoFit(y,t,wn,optionPlot)
2+
% [zeta] = expoFit(y,t,wn) returns the damping ratio calcualted by fitting
3+
% an exponential decay to the envelop of the free-decay response.
4+
%
5+
% Input:
6+
% y: envelop of the free-decay response: vector of size [1 x N]
7+
% t: time vector [ 1 x N]
8+
% wn: target eigen frequencies (rad/Hz) : [1 x 1]
9+
% optionPlot: 1 to plot the fitted function, and 0 not to plot it.
10+
%
11+
% Output
12+
% zeta: modal damping ratio: [1 x 1]
13+
%
14+
% author: E. Cheynet - UiB - last updated: 14-05-2020
15+
%
16+
17+
%%
18+
% Initialisation
19+
guess = [1,1e-2];
20+
% simple exponentiald ecay function
21+
myFun = @(a,x) a(1).*exp(-a(2).*x);
22+
% application of nlinfit function
23+
coeff = nlinfit(t,y,myFun,guess);
24+
% modal damping ratio:
25+
zeta = abs(coeff(2)./wn);
26+
27+
% alternatively: plot the fitted function
28+
if optionPlot== 1, plot(t,myFun(coeff,t),'r'); end
29+
end
30+

0 commit comments

Comments
 (0)