Академический Документы
Профессиональный Документы
Культура Документы
Anders Brandt
February 3, 2013
Contents
Preface v
1 Introduction 1
5 Fundamental Mechanics 19
15 Orthogonalization of Signals 61
iii
16 Advanced Analysis Methods 63
Bibliography 65
Preface
This is a document with answers and solution examples for the Problems in
my book ‘Noise and Vibration Analysis: Signal Analysis and Experimental
Procedures’ [1]. It is available for anyone, and can be downloaded from my
website http://www.abravibe.com if you obtain a verified login account.
The answers and solution examples are formulated in a form that I per-
sonally prefer. This means that in most cases the solutions are ‘pragmatic’
rather than stringent. I hope you like this. In many cases the solutions pre-
dominantly consist of MATLAB/Octave code. For these code examples to
work, in most cases you will have to have installed the accompanying toolbox,
ABRAVIBE which can also be downloaded from my website. In addition,
you usually have to add plotting etc., as I have tried to keep this document
as short as possible by not including obvious things.
I hope this document will be useful for your teaching or learning of vi-
brations and vibration analysis! Please feel free to contact me through my
website if you have any questions or suggestions for improvements.
Odense February 3, 2013
Anders Brandt
v
Chapter 1
Introduction
No Problems!
1
Solutions to Book Problems
Problem 2.1.
a) 5 V.
b) 10 Hz.
c) The function value at t = 0 is approximately 3.5. The initial phase
angle is thus found by solving 5sin(φ) = 3.5 which gives φ ≈ 0.775 rad or
approximately 45 degrees. This answer must be taken rather approximately,
as it is strongly dependent on the value of the function at t = 0 which is not
readily read by any accuracy.
d) Let us first assume that the angle in c) is exactly 45 degrees, or π/4
radians. Thus
We thus have that the sought, complex sine is x̃(t) = 5ej(2π·10t−π/4) ≈ 3.54(1−
j)ej2π·10t
Problem 2.2. The RMS level is found as the square root of the mean of the
mean of a signal sin2 (ωt) is one half (0.5), the sought
squared signal. As theq
√
RMS level is xrms = 42 /2 = 4/ 2. It is also quite acceptable to simply
√
‘know’ that the RMS level is always the amplitude divided by 2.
1 f1=50;
2 f2=[10 20 40 50 60 80 100 48 49 51 52];
3 for n = 1:length(f2)
4 m=multsines(f1,f2(n));
5 pause
3
Solutions to Book Problems
6 end
7 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
8 % The function
9 function [y,t] = multsines(f1,f2)
10 fs=10*max(f1,f2);
11 T=10*max(1/f1,1/f2);
12 t=(0:1/fs:T)';
13 y=sin(2*pi*f1*t).*sin(2*pi*f2*t);
14 m=mean(y);
15 plot(t,y)
16 xlabel('Time [s]')
17 s=sprintf('f1=%i, f2=%i, and mean = %6.2f',f1,f2,m);
18 title(s)
Problem 2.6. Using the partial fraction expansion from Problem 2.5, and
observing that R1 = −R2 , we have that
j h √ √ i
h(t) = R1 es1 t + R2 es2 t = √ −e(−1+j 3)t + e(−1−j 3)t
2 3
j h √ √ i je−t √
= √ e−t e−j 3t − ej 3t = √ · (−2) · j sin( 3t)
2 3 2 3
e −t √
= √ sin( 3t)
3
Impulse Response
0.3
0.25
0.2
0.15
0.1
0.05
−0.05
0 2 4 6 8 10
Time [s]
1 t=(0:1/100:10);
2 hc=exp(−t)/sqrt(3).*sin(sqrt(3)*t);
3 A=[1 2 4];
4 B=1;
5 [R,p]=residue(B,A);
6 h=real(R(1)*exp(p(1)*t)+R(2)*exp(p(2)*t));
7 plot(t,h,t,hc)
Frequency Response
−2
10
−4
10
0 0.5 1 1.5 2
0
Phase [Deg.]
−50
−100
−150
−200
0 0.5 1 1.5 2
Frequency [Hz]
3 H=1./(jw.^2+2*jw+4);
4 semilogy(f,H)
QED
1 fs=2000;
2 T=0.05;
3 t=(0:1/fs:T)';
4 x1=cos(2*pi*800*t);
5 x2=cos(2*pi*1200*t);
6 M=max(abs(x1−x2));
7 fprintf('Max deviation is approx. %5.2g\n',M)
Problem 3.2. First, note the printing error in Eq.(3.30), where t is missing
in both exponents, see the latest errata list. In the frequency domain, the
output spectrum at the frequency fn , n = 1, 2 will be
9
Solutions to Book Problems
∠X2 − ∠X1
=b
ω1 − ω2
then for the output signal, the corresponding relation between the angles of
the two components are
∠Y2 − ∠Y1
= b + (1 + A) = C
ω1 − ω2
which is independent of the frequencies f1 and f2 . Thus, the relative phase
relationships between the frequencies are kept through the filter H(f ). QED
1 fs=1;
2 dt=1/fs;
3 f=linspace(0,0.5,1000)';
4 jw=j*2*pi*f;
5 Hi=dt./(1−exp(−jw));
6 subplot(2,1,1)
7 loglog(f,abs(Hi),f,abs(1./jw));
8 subplot(2,1,2)
9 semilogx(f,angledeg(Hi),f,angledeg(1./jw))
1 fs=1;
2 dt=1/fs;
3 f=linspace(0,0.5,1000)';
4 jw=j*2*pi*f;
5 B=dt*[1 −1];
6 A=1;
7 Hd=freqz(B,A,f,fs);
plus plotting commands similar to those for Problem 3.3. The result should
be similar to Figure 3.2.
Problem 3.5. The following code can be used. A special ‘trick’ is necessary
to compensate the frequency response for the time dealy corresponding to 6
samples.
5
10
Log. Magnitude
0
10
−5
10
−3 −2 −1
10 10 10
0
Integrator
Phase, [Deg.]
True
−50
−100
−3 −2 −1
10 10 10
Log. Relative Frequency f/fs
5
10
Log. Magnitude
0
10
−5
10
−3 −2 −1
10 10 10
100
Phase, [Deg.]
50
diff
True
0
−3 −2 −1
10 10 10
Log. Relative Frequency f/fs
−50
−100
Log. Magnitude
−150
−200
−250
−300
−350
−3 −2 −1
10 10 10
Log. Rel. Frequency f/fs
1 fs=1;
2 N=1001;
3 f=linspace(0,0.5,N);
4 jw=j*2*pi*f;
5 [B,A]=mfdfilt(6); % See inside for details
6 Hd=freqz(B,A,f,fs);
7 Hd=Hd.*exp(2j*pi*6*f); % Adjust for time delay
8 d=(Hd−jw)./jw;
9 semilogx(f,db20(d));
plus plotting commands similar to those for Problem 3.3. The result should
be similar to Figure 3.3. The error at f /fs = 0.01 is approximately -131.5
dB.
Problem 3.6. The folowing code computes the true differentiated signal in
yt, and a differentiated output in yr (using remez algorithm) and ym (using
maxflat). If you are using Octave, please note that only maxflat is possible.
A suitable way to compute how similar the signals are, is to compute the
standard deviation of the difference between the signals. It is also a good ide
to normalize this value with the standard deviation of the true differentiated
signal.
1 fs=2300;
2 t=(0:1/fs:10)';
3 x=sin(2*pi*230*t);
4 yt=(2*pi*230)*cos(2*pi*230*t);
5 Type='remez';
6 yr=timediff(x,fs,Type);
7 L=length(yr);
8 % Throw away transient start signal
9 dr=std(yr(100:L)−yt(100:L))/std(yt)
10 Type='maxflat';
11 ym=timediff(x,fs,Type);
12 L=length(ym);
13 dr=std(ym(100:L)−yt(100:L))/std(yt)
You should note that the first 100 samples are thrown away. Try running
the script with this reduces to 10 and to 1, respectively. You will see that it
makes a big difference! If you plot yr and yt overlaid you will see why. The
differentiation filters take a few samples before they settle (i.e. the transient
response dies out).
Problem 3.7. The folowing code computes the true integrated signal in yt,
and integrated outputs in ys, yh, and yi for simple, hpfilter, and IIR type,
respectively.
1 fs=2300;
2 t=(0:1/fs:10)';
3 x=sin(2*pi*230*t);
4 yt=−1/(2*pi*230)*cos(2*pi*230*t);
5 Type='simple';
6 ys=timeint(x,fs,Type);
7 L=length(ys);
8 % Throw away transient start signal
9 ds=std(ys(100:L)−yt(100:L))/std(yt)
10 Type='hpfilter';
11 yh=timeint(x,fs,Type);
12 L=length(yh);
13 dh=std(yh(100:L)−yt(100:L))/std(yt)
14 Type='iir';
15 yi=timeint(x,fs,Type);
16 L=length(yi);
17 di=std(yi(100:L)−yt(100:L))/std(yt)
You should note how much better the IIR method is compared with the other
two methods.
(x − x̄)2 σx2
" #
h i 1 h i
σz2 = E (z − z̄) 2
=E = E (x − x̄)2
) = =1
σx2 σx2 σx2
Problem 4.2. We have that
Z z0 Z z0 1 Z z0 − z 2
pz (z)dz = 2 pz (z)dz = 2 √ e 2 dz
−z0 0 2π 0
Thus, with Eq. (4.42) we have that
! √
z0 2 Z z0 / 2 −t2
erf √ =√ e dt =
2 π 0
√ √
t = z/ 2 ⇒ dt = dz/ 2
= √ =
t = 0 ⇒ z = 0, t = z0 / 2 ⇒ z = z0
2 Z z0 −z2 √
=√ e 2 dz/ 2 =
π 0
s
2 Z z0 −z2 1 Z z0 −z2
= e 2 dz = 2 √ e 2 dz
π 0 2π 0
The last equation is equal to the last integral in the first equation in this
example. QED
15
Solutions to Book Problems
0
0.4 10
0.2
−5
0 10
−5 0 5 −5 0 5
0
0.4 10
0.2
−5
10
0
−10 0 10 −5 0 5
1 % Linear plots
2 x=randn(100000,1);
3 [pdfx,ax]=apdf(x,50,1);
4 y=x+0.1*x.*abs(x);
5 [pdfG,ay]=apdf(y,50,1);
6 % sometimes better with log plots
7 x=randn(100000,1);
8 [pdfx,ax,Gx]=apdf(x,50,2);
9 y=x+0.1*x.*abs(x);
10 [pdfy,ay,Gy]=apdf(y,50,2);
Problem 4.5. The following code creates the data and test for stationarity
with the reverse arrangements test.
1 x=randn(100000,1);
2 s=sin(linspace(0,pi,100000))';
3 y=x.*s;
4 % Reverse arrangements test on std
5 N=100;
6 F=framestat(y,N,'std');
7 alfa=0.02;
8 status=teststat(F,0.02,'reverse')
The result of the test is that data in y are stationary (despite the fact that
the data are obviously not stationary). The reverse arrangements test tests
if each frame result is larger or smaller that all subsequent frames. If data
are stationary, the principle of the test is that each frame should be larger
than approximately half of the subsequent frames. This does, however, occur
also in the case of the present data, since the amplitude of the random signal
increases and decreases in amplitude over equal amount of time. The reverse
arrangements test simply does not detect this case of nonstationarity.
Problem 4.6. The following code creates the data and test for stationarity
with the runs test.
1 x=randn(100000,1);
2 s=sin(linspace(0,pi,100000))';
3 y=x.*s;
4 % Reverse arrangements test on std
5 N=100;
6 F=framestat(y,N,'std');
7 alfa=0.02;
8 status=teststat(F,0.02,'runs')
The runs test detects that data are nonstationary. This is because the runs
test is sensitive to trends in the data, as each frame result is checked against
only adjacent frame results when it produces the number of runs. Thus data
such as the data in y produces much too few runs.
Fundamental Mechanics
19
Solutions to Book Problems
and thus
1
A=
mωd
and Eq. (5.15) is thus proved.
Problem 5.4. First, note the missing mass in this Problem. As mentioned
in the errata list, assume a unity mass, i.e. m = 1 kg. The following code
can be used. The code is written as two functions only because it can then
contain the whole solution in one file; otherwise it had to be split into a script
file and a function file, for example. This code uses the envelope computation
using the Hilbert transform. This is kind of advanced considering the Hilbert
transform is not introduced until Chapter 16. You are not expected to have
come up with this method in your solution. You can rather use a cursor and
manually find where the impulse response has decayed to a certain amount of
the start value. However, the method below allows for ‘automatic’ detection
of how many periods of oscillation the impulse response goes through before
reaching approximately 1 % of the beginning value.
Change the damping where it says, and run again
1 function problem5_4
2 fn=[1 10 20 50 100 1000];
3 z=[0.05]; % Try different values, say 0.1, 0.05, 0.02!
4 for n=1:length(fn)
5 [h,t,fs]=fz2impresp(fn(n),z);
6 figure
7 plot(t,h)
8 xlabel('Time [s]')
9 title(['f_n = ' num2str(fn(n))]);
10 e=abs(hilbert(h/max(h)));
11 idx=min(find(e < .01));
12 T=t(idx);
13 Nper(n)=floor(T*fn(n));
14 pause
15 close
16 end
17 Nper
18 % Nper=−log(0.01)/(2*pi*z) % within resolution
19 end
20 function [h,t,fs]=fz2impresp(fn,z)
21 m=1;
22 wd=2*pi*fn*sqrt(1−z^2);
23 A=1/(m*wd);
24 % fs is unspecified: set to 100*fn
25 fs=10*fn;
26 % We also need to set some max. time
27 % Let's say 100 periods of fn
28 T=100/fn;
29 t=(0:1/fs:T)';
30 h=A*exp(−z*2*pi*fn*t).*sin(wd*t);
31 end
The code shows that for each damping value, the number of periods until
the impulse response has decayed is constant, independent of the natural fre-
quency, fn . This is not surprising, since the exponential decay is e−ζ2πfn t,
and in this expression, fn t, for a particular time t, is the number of periods
of oscillation with the frequency fn . Thus, if we set the decay to 0.01, for
example, as in the MATLAB/Octave code above, then we have that
− ln(0.01)
fn t =
2πζ
1 function problem5_5
2 fn=1;
3 z=[0.01 0.05 0.1];
4 for n=1:length(z)
5 [H(:,n),f]=sdofmob(fn,z(n));
6 end
7 figure
8 subplot(1,3,1)
9 plot(f,abs(H))
10 grid
11 subplot(1,3,2)
12 semilogy(f,abs(H))
13 grid
14 subplot(1,3,3)
15 loglog(f,abs(H))
16 grid
17 end
18 function [H,f]=sdofmob(fn,z)
19 m=1;
20 % Specify frequency axis with N=1000 and up to 10*fn
21 f=linspace(0,5*fn,1000);
22 jw=j*2*pi*f;
23 H=jw/m./(jw.^2 +jw*2*z*2*pi*fn + (2*pi*fn)^2);
24 end
The code for accelerance is obtained by simply multiplying the mobility in the
sdofmob function above (on line 23) by jω (and preferrably change the name
to sdofacc).
Problem 5.6. The following code is a slight modification to the problem text.
It produces the same result.
1. Go to the highest frequency and read out H(∞) ≈ 1/m from which you
extract the mass.
2. Read the
q frequency of the peak, and extract the stiffness by solving fn =
1/(2π) (k/m).
3. The damping is a little more tricky. First find Hmax , and then go down
-3 dB to Hmax /sqrt(2) on both sides of the peak, to find the resonance
bandwidth Br = fu − fl , the upper minus the lower -3 dB frequencies.
The damping is then found by ζ = Br /(2fn ).
An alternative to find the stiffness is to convert the accelerance to dy-
namic flexibility (receptance, displacement/force) by dividing the accel-
erance by −ω 2 . At low frequencies, the FRF is now approaching 1/k.
Problem 5.7. A force balance equation on the mass at the top of Fig. (5.11)
(b) yields (using y for the mass displacement as in (a))
Fe (t) = cẏ + ky
which is identical to the expression on the right-hand side of Eq. (5.51). Since
it has already been shown that Eq. (5.51) leads to Eq.|(5.54), the expression
on the right-hand side of Eq. (5.55) will be the same as the right-hand side
of Eq. (5.54). QED.
25
Solutions to Book Problems
1.14 · 104
(
λ=
0.264 · 104
Because the system has proportional damping, the mode shapes are iden-
tical to those of the undamped system. Thus, once the poles (eigenvalues) are
calculated, we insert them into the equation for the undamped system
We now use the mode shapes to diagonalize the mass, damping, and stiff-
ness matrices, from which we can find the poles of the damped system. Thus
" #T " #" #
T 0.562 0.965 2 0 0.562 0.965
⌈Mr ⌋ = [Ψ] [M ] [Ψ] = =
0.827 −0.262 0 5 0.827 −0.262
& %
4.05 0
=
0 2.21
Similarly & %
1.07 0
⌈Kr ⌋ = · 104
0 2.51
& %
21.3 0
⌈Cr ⌋ = · 104
0 13.5
Using the modal mass, modal damping, and modal stiffness values as
SDOF systems, we obtain natural frequencies and damping factors
s
1 k1
f1 = = . . . = 8.18Hz
2π m1
c1
ζ1 = √ = . . . = 0.074 = 5.1%
2 m1 k1
s
1 k2
f2 = = . . . = 17.0Hz
2π m2
c2
ζ1 = √ = . . . = 0.077 = 2.9%
2 m2 k2
By which we can compute the complex poles (with positive imaginary part;
the complex conjugates are also poles) as
q
s1 = −ζ1 ω1 + jω1 1 − ζ1 = −2.63 + j51.3
q
s2 = −ζ1 ω1 + jω1 1 − ζ1 = −3.07 + j106.5.
Solution procedure 2
In the second approach, we first calculate K −1 M
" #
0.133 · 10−3 −0.167 · 10−3
[Kp ] = . . . =
−0.0667 · 10−3 0.333 · 10−3
We insert the eigenvalues into the equation for the undamped system
[Kp ] − λr [I] = {0}
which, for the first (highest, because the eigenvalues are now proportional to
1/s2 ) eigenvalue, of 0.379 · 10−3 gives us
" # ( )
0.133 · 10−3 − 0.379 · 10−3 0.167 · 10−3 ψ1
=
0.0667 · 10−3 0.333 · 10−3 − 0.264 · 10−3 ψ2 1
In the previous step we thus obtained the same mode shapes as in Solution
procedure 1, although to roots of the system equation (Kp ) was different. From
this stage on, the solutions are the same.
Problem 6.3. The following code is a solution using eig (assuming matrices
already defined as in above two problems)
−1
10
−2
10
Mobility [(m/s)/N]
−3
10
−4
10
0 10 20 30 40 50
Frequency [Hz]
Problem 6.4. First note the errata list change, that the formulation should
be according to Eq. (6.100). An example of code to produce the task in this
Problem is found in the AbraVibe command mck2frf which is used in the
following lines of code:
1 f=(0:.001:50)';
2 Hv=mck2frf(f,M,C,K,[1:2],[1:2],'v');
3 figure
4 [N,D,R]=size(Hv);
5 for r=1:R
6 for d=1:D
7 semilogy(f,abs(Hv(:,d,r)));
8 hold on
9 end
10 end
The resulting FRFs can be seen in Fig. 6.1. As is obvious from the plot, only
three FRFs are visible. The reason is, of course, that (Maxwell’s) reciprocity
gives that H12 = H21 and therefore these two FRFs look like one.
The following code solves the poles and mode shapes of the system using a
state space formulation. The code come to the most part from the AbraVibe
command mck2modal, the part after detecting non-proportional damping.
Problem 6.5.
Problem 6.6. The following code uses the results from Problem 6.5 to pro-
duce the FRFs using Eq. (6.110)
15 end
It should be noted that this could be done very simply using AbraVibe, in
the following way.
1 f=(0:.001:50)';
2 [p,V]=mck2modal(M,C,K);
3 Hv=modal2frf(f,p,V,[1:2],[1:2],'v');
Problem 6.7. In this example we add 5 to C(1,1) and recalculate the poles
and mode shapes. Using mck2modal we get
1 [p,V]=mck2modal(M,C,K);
2 % Rotate vectors to real first element (row 1)
3 phi=angle(V(1,:));
4 phi=diag(exp(−j*phi));
5 V=V*phi;
6 V(:,1)=V(:,1)/norm(V(:,1));
7 V(:,2)=V(:,2)/norm(V(:,2));
8 disp('poles:')
9 p
10 listpoles(p)
11 disp(' ')
12 disp('mode shapes:')
13 V
14 angledeg(V)
As can be seen, the undamped natural frequencies are unchanged within the
three digits we have used (although with more digits there is a slight difference,
of course) and damping ratios are changed to 5.5 % and 3.9 %, respectively.
As the last output of the script shows, the phase angles between the two masses
are approximately 0.8 degrees for the first mode (instead of zero), and 178
degrees for the second mode (instead of 180). The two masses thus still move
almost in- versus out-of-phase in the two modes.
Problem 6.8. For this problem we force the 2DOF system from the problems
above with a frequency very close to the first mode, say, f0 = 8.5Hz. we use
the command timefresp to excite the first mass and compute the responses
of the two masses. Then we change the damping of both modes to 1 % and
rerun. The following code shows how.
1 [p,V]=mck2modal(M,C,K);
2 [fr,zr]=poles2fz(p);
−4
x 10
5
−5
0 5 10 15 20
−3
x 10
1
−1
0 5 10 15 20
3 listpoles(p);
4 f0=8.5;
5 fs=500;
6 t=(0:1/fs:20)';
7 F=sin(2*pi*f0*t);
8 u1=timefresp(F,fs,p,V,1,[2],'d');
9 % Change damping to 1%
10 p=fz2poles(fr,0.01);
11 u2=timefresp(F,fs,p,V,1,[2],'d');
The results should look similar to Fig. 6.2 As can be seen in the plot, with
these numbers, the system takes approximately 2 seconds to settle when damp-
ing is the original damping. When reducing the damping of both modes to 1
%, it takes approximately 8 seconds for the transient to die. Try changing
the frequency of the sine closer to and further from the eigenfrequencies of
the system and see what happens!
1 fc=2;
2 f=(0:.01:200)';
3 jwwc=j*f/fc;
4 H=jwwc./(1+jwwc);
5 Hmag=abs(H);
6 idx=min(find(Hmag ≥ 0.95));
7 fmin=f(idx)
33
Solutions to Book Problems
I 4 · 10−3
fmathrmmax = = ≈ 44kHz.
2πVp CL 2π3 · 94 · 10−3 · 50
Problem 8.1. To make it easier to calculate the Fourier series, we can make
two changes. First, we define a slightly different square wave signal
(
0 −Tp /2 ≤ t < 0
xp (t) =
10 0 ≤ t < Tp /2
with Tp = 1/f1 . Since the amplitude of this square wave varies between 0 and
1, then evidently the square wave signal in the Problem definition is
xs (t) = −5 + xp (t)
Since (
1 k = 0, 2, 4, . . .
cos(kπ) =
−1 k = 1, 3, 5, . . .
then bk = 0, k = 0, 2, 4, . . ., and
20
bk = k = 1, 3, 5, . . .
kπ
We can thus write the modified square wave signal as
!
20 sin(3v) sin(5v)
xp (v) = 5 + sin(v) + + + ...
π 3 5
and the original square wave we wanted is thus equal to
!
20 sin(3v) sin(5v)
xs (t) = sin(v) + + + ...
π 3 5
Problem 8.2. The easiest in this case is to note that the triangle as defined
in Fig. 8.3 is the integral of a square wave. We thus form a generic square
wave as in eq. 8.1. With unity amplitude a square wave thus can be written
as !
1 4 sin(3v) sin(5v)
xp (v) = + sin(v) + + + ...
2 π 3 5
By integrating this and noting that the first term must disappear since the
triangle does not include a trend, and since we do not know the amplitude,
then the triangle xt (v) can be written as
Z
sin(3v) sin(5v)
xt (v) = A sin(v) + + + . . . dv
3 5 !
cos(3v) cos(5v)
= −A cos(v) + + + ...
32 52
or, if we want to have it as a function of frequency,
!
cos(6πf1 t) cos(10πf1 t)
xt (t) = −A cos(2πf1 t) + + + ...
32 52
Plotting this function for A = 1 and watching the amplitude, it can be con-
cluded that the true amplitude should be A ≈ 2/π. The frequency is, of course
f1 = 5 Hz.
A small note is appropriate: A more common definition of a triangle wave
is perhaps the odd function obtained by time shifting the signal in the current
Problem a quarter period to the left. This function can easily be seen to be
composed of two straight lines, with positive slope from −π/2 to π/2, and
negative slope from pi/2 3π/2. Setting this up in Eq. (8.2) is rather straight-
forward, and the Fourier series expression then becomes the, perhaps, more
well-known
!
8 sin(6πf1 t sin(10πf1 t
xt (t) = 2 sin(2πf1 t) − ...
π 32 32
Problem 8.3. We start by proving Eq. (4.37) by using Eq. (4.32). It follows
that since
Ryx (τ ) = E [y(t)x(t − τ )]
then by substitution we have that
Rxy (τ ) = E [x(t)y(t − τ )] =
{u = t − τ ⇒ t = u + τ }
= E [y(u)x(u + τ )] = Ryx (−τ )
Next we look at the autospectral density Sxx (f ) where we have that, because
Rxx (−τ ) = Rxx (τ ) then,
Z ∞
Sxx (−f ) = Rxx (τ )e−j2π(−f )τ dτ =
−∞
{u = −τ ⇒ du = −dτ ; τ = −∞ ⇒ u = ∞; τ = ∞ ⇒ u = −∞; }.
Z −∞ Z ∞
−j2πf u
= Rxx (−u)e (−du) = Rxx (u)e−j2πf u du = Sxx (f )
∞ −∞
Experimental Frequency
Analysis
Problem 9.1. The difference between the correct (periodic) and the incorrect
(non-periodic) time windows is most easily seen in the real and imaginary
parts. The following MATLAB/Octave code thus produces the data plotted
in Fig. 9.1. As can be seen in the plot, for a non-periodic time window, the
imaginary part does not equal zero (within numerical resolution) despite the
fact that the actual signal is even.
1 A1=3; f1=20;
2 A2=5; f2=40;
3 fs=512;
4 N=1024;
5 t=(0:1/fs:(N−1)/fs)';
6 y=A1*cos(2*pi*f1*t)+A2*cos(2*pi*f2*t);
7 % Correct (i.e. periodic) Hanning window
8 Y1=fft(ahann(N).*y)/N;
9 % Incorrect (i.e. non−periodic) Hanning window
10 Y2=fft(hann(N).*y)/N;
11 % Scale for amplitude (2 for single−sided, 2 for Hanning ...
amplitude
12 % compensation; DC bin is zero so nevermind to treat ...
separately)
13 Y1=Y1(1:N/2+1);
14 Y1=4*Y1;
15 Y2=Y2(1:N/2+1);
16 Y2=4*Y2;
Problem 9.2. Two harmonic components with different frequencies are or-
thogonal. Therefore the RMS value of the sum, given the two RMS levels
39
Solutions to Book Problems
0 0
−5 −5
0 100 200 300 0 100 200 300
5 0.01
0 0
−5 −0.01
0 100 200 300 0 100 200 300
The RMS value of the time signal can be computed either using the standard
deviation std command (since the mean of the signal is zero), or by the
AbraVibe toolbox command arms, which gives the same value.
Problem 9.3. It is reasonable to try some frequencies either on, or right in
between, the bins of the DFT. The Problem can be thus be executed by the
following MATLAB/Octave code, which results in the plots in Fig. 9.2 and
Fig. 9.3. Other frequencies can, of course, also be used.
1 A1=3; f1=20;
2 A2=5;
3 fs=512;
4 N=1024;
5 t=(0:1/fs:(N−1)/fs)';
6 % First frequencies on DFT bins
7 f2=[21 22 23 24];
8 for n=1:length(f2)
9 y=A1*cos(2*pi*f1*t)+A2*cos(2*pi*f2(n)*t);
10 [Y1(:,n),f]=alinspec(y,fs,ahann(N));
11 end
12 % Then frequencies between DFT bins
f1 = 20, f2 = 21 Hz f1 = 20, f2 = 22 Hz
4 4
2 2
0 0
20 22 24 26 20 22 24 26
f1 = 20, f2 = 23 Hz f1 = 20, f2 = 24 Hz
4 4
2 2
0 0
20 22 24 26 20 22 24 26
Figure 9.2: Plots for Problem9.3 with frequencies of second harmonic com-
ponent exactly on DFT bins
13 f2=[21 22 23 24]−0.25;
14 for n=1:length(f2)
15 y=A1*cos(2*pi*f1*t)+A2*cos(2*pi*f2(n)*t);
16 [Y2(:,n),f]=alinspec(y,fs,ahann(N));
17 end
The conclusion from the plots is that it is impossible to give any exact number
for the difference in frequencies which can be resolved, because it depends on
the amplitudes and frequencies of the involved harmonics (for example leakage
has a significant effect). To be safe, several analyses with different frequency
increment should be made.
Problem 9.4. This problem is easily executed by replacing the time window
ahann(N)in the call to alinspec command from Problem 9.3 by the flattop
command aflattop(N). The results should look like plots in Figs. 9.4 and
9.5.
Problem 9.5. To obtain correct convolution result when using DFT and
multiplication in the frequency domain, zero padding has to be used prior
to the DFT computation. This Problem can thus be executed by the MAT-
LAB/Octave code below, where for comparison, also the (erroneous) cyclic
convolution result is included.
2
2
1
0 0
20 22 24 26 20 22 24 26
f1 = 20, f2 = 22.50 Hz f1 = 20, f2 = 23.50 Hz
4 4
2 2
0 0
20 22 24 26 20 22 24 26
Figure 9.3: Plots for Problem9.3 with frequencies of second harmonic com-
ponent between DFT bins
f1 = 20, f2 = 21 Hz f1 = 20, f2 = 22 Hz
6 4
4
2
2
0 0
20 22 24 26 20 22 24 26
f1 = 20, f2 = 23 Hz f1 = 20, f2 = 24 Hz
4 4
2 2
0 0
20 22 24 26 20 22 24 26
Figure 9.4: Plots for Problem9.4 with frequencies of second harmonic com-
ponent exactly on DFT bins
2
2
1
0 0
20 22 24 26 20 22 24 26
f1 = 20, f2 = 22.50 Hz f1 = 20, f2 = 23.50 Hz
4 4
2 2
0 0
20 22 24 26 20 22 24 26
Figure 9.5: Plots for Problem9.4 with frequencies of second harmonic com-
ponent between DFT bins
1 x1=ones(1,8)
2 x2=[1 2 3 4 3 2 1 1]
3 disp('Regular convolution gives:')
4 c1=conv(x1,x2)
5 % With DFT:
6 disp('DFT convolution with zero padding gives')
7 c2=real(ifft(fft(x1,16).*fft(x2,16)));
8 round(c2)
9 % Compare this with cyclic convolution
10 c3=real(ifft(fft(x1).*fft(x2)))
1 fs=1024;
2 N=1024;
3 A=5; f0=5;
4 % Create time axis and funtion
5 t=(0:1/fs:(N−1)/fs)';
6 % One block of data is enough as the signal is deterministic
7 x=A*sin(2*pi*f0*t);
8 % Autopower spectrum, Eqs. (10.1) and (10.3)
9 X=fft(x.*ahann(N));
10 Sxx=abs(X).^2; % Double−sided power conversion
11 Sa=2*winacf(ahann(64))^2/N^2; % Eq. (10.3)
12 Axx=Sa*Sxx(1:N/2+1); % Save up to fs/2
13 % Final autopower spectrum
14 Axx(1)=Axx(1)/2; % DC correction
15 % Linear spectrum
16 X_L=sqrt(Axx);
Problem 10.3. To compute the RMS level from a linear spectrum, we have
to take care of the equivalent noise bandwidth, which can be computed using
the winenbw command from the AbraVibe toolbox. The RMS summation
45
Solutions to Book Problems
is thus made by running the code listed for Problem 10.1 followed by the
command line
1 Rx=sqrt(sum(X_L.^2)/winenbw(ahann(256)))
√
To test it, compare the value with the true value of 5/ 2 ≈ 3.5355.
Problem 10.4. This Problem is solved by running the code from Prob-
lem 10.2 and then replacing the time window in Problem 10.3 by the
aflattop command. The results should, of course, be the same RMS level,
3.5355 as in the previous Problems.
Problem 10.5. Here we will use the AbraVibe command apsdw to compute
the PSD. See inside this command for details of the implementation. To
evaluate the command you have developed in this Problem, the following code
can be used (by replacing the apsdw command with the command you have
developed yourself).
1 x=randn(100*1024,1);
2 N=1024;
3 fs=100; % Can be anything
4 % Compute a PSD with 50% overlap and Hanning window
5 [Pxx,f]=apsdw(x,fs,N);
6 RMSx=arms(x)
7 df=f(2)−f(1);
8 RMS_p=sqrt(df*sum(Pxx))
Problem 10.6. The following code computes the random error two ways and
give reasonable good accuracy for the experimentally obtained value.
Va = Sa · a = 10.23 · 34 ≈ 348mV
47
Solutions to Book Problems
1 StartRPM=800;
2 EndRPM=5800;
3 RunUpTime=60;
4 RMS1min=1; RMS1max=2;
5 RMS2min=.5; RMS2max=8;
6 % Define sampling frequency
7 fs=4*EndRPM/60*2; % 2 because order two
8 % Create time axis and tacho signal
9 t=(0:1/fs:RunUpTime)';
10 Tacho=chirp(t,StartRPM/RunUpTime,t(end),EndRPM/60);
11 Order2=chirp(t,2*StartRPM/RunUpTime,t(end),2*EndRPM/60);
12 % Create envelopes for order 1 and 2
13 o1env=RMS1min+(RMS1max−RMS1min)*sin(pi*t/RunUpTime);
14 o2env=RMS2min+(RMS2max−RMS2min)*abs(sin(2*pi*t/RunUpTime));
15 % Create order 1 and 2 and sum to runup−variable
16 o1=sqrt(2)*Tacho.*o1env;
17 o2=sqrt(2)*Order2.*o2env;
18 x=o1+o2;
19 % Now extract and plot the rpm−time profile
20 rpm=tacho2rpm(Tacho,fs,0,1,1,fs,50);
The resulting vibration signal and rpm-time profile should look similar to the
plot in Figure 12.1 (a) and (b).
Problem 12.2. Assuming the MATLAB code in Problem 12.1 has first been
executed, the following lines of code solves the current problem.
1 N=1*1024;
2 % Produce and plot RPM map
3 [S,F,R] = rpmmap(x,fs,rpm,t,StartRPM,EndRPM,50,ahann(N));
49
Solutions to Book Problems
(a) (b)
20 6000
RPM
0
2000
−20 0
0 20 40 60 0 20 40 60
Time [s] Time [s]
(c) (d)
5 5
0 0
1000 2000 3000 4000 5000 1000 2000 3000 4000 5000
RPM RPM
4 figure
5 plotrpmmapc(S,F,R)
6 % Extract orders 1 and 2 and overlay with true values
7 orders=map2order(S,F,R,[1 2],'hann5');
8 plot(R,orders,rpm,[o1env o2env])
The resulting order tracks should look similar to Figure 12.1 (c). Changing
the blocksize N should result in the finding that 1K is the maximum blocksize
before smearing starts to seriously impact the order tracks.
Problem 12.3. Assuming Problem 12.1 has first been executed, the following
lines resamples the time data and extracts the two first orders.
The resulting order tracks should look similar to Figure 12.1 (d).
Single-input Frequency
Response Measurements
Problem 13.1. Since we can usually remove the large part of any extrane-
ous noise in the force signal by using a force window, the suitable estimator
is the H1 estimator, which removes the effect of any noise in the output
(acceleration, typically) signal.
Problem 13.2. This problem can be solved with code similar to the following.
Note that due to the random nature of the excitation, every realization does
not give identical result. You should rerun the example a few times and
see what changes. This gives you an idea of the statistical spread when 100
averages are used. The results should look similar to the plot in Figure 13.1
51
Solutions to Book Problems
−2.35
10
4096
FRF [m/N] 8192
16384
−2.45
10
12 12.2 12.4 12.6 12.8 13
Frequency [Hz]
Coherence [−]
0.99
0.98
12 12.2 12.4 12.6 12.8 13
Frequency [Hz]
18 H{n}=Ht;
19 C{n}=Ct;
20 f{n}=ft;
21 end
Problem 13.3. You should note that this is an example without extraneous
noise on the signals. So, any imperfections in the estimate, will come from
leakage effects (or numerical accuracy at the highest frequencies). The inten-
tion with the first part of this problem, using blocksize N = 1024 samples, is
intended to show that this is an inappropriate blocksize; it is too small rela-
tive to the length of the impulse response (or rather, with the given sampling
frequency, the time length of the 1024 blocksize block is too short relative to
the length of the impulse response of the system). This is difficult to see
when you are running the example, but as soon as the blocksize is increased
to 2048 samples, it should be clear that the coherence really looks better (up to
approximately 80 Hz or so; higher up in frequency the simulation method is
affecting the results so this frequency range should not be considered). This is
an important situation which also occurs in real measurement cases, and thus
it has to be identified so one does not accidentally conclude that the imperfect
coherence is caused by sensor noise or some other inevitabile source.
The following code could be used to estimate the frequency response and
coherence. By changing the blocksize and burst length the different solutions
requested in the Problem definition can be obtained.
If this code is run several times, changing the burst length between each
run, it should be obvious that the maximum burst length is approximately
40 % after which the coherence gets much worse. Increasing the blocksize to
2048, and rerunning the code lines with different burst lengths, you should see
that the coherence now gets better, and that the burst length can be increased
at least up to 60 %. It is important to separate these two results; the reason
the coherence is better overall with this blocksize, is that the block length (in
seconds) is now large enough relative to the impulse response length which
causes the type of error discussed in Section 13.5.1 and illustrated in Figure
13.6 in the book. The second result, that is, the reason the burst length (in %)
can be longer when the blocksize is longer is, of course, that the time it takes
for the system to settle is determined in seconds (by the system damping), and
thus the longer the block time, the longer the burst length can be, in percent
of the block time without causing leakage. Increasing the blocksize to 4096,
you should see an even better coherence, around 70 to 80 Hz. The difference
is subtle, but it is clear that the blocksize of 2048 is also unsufficient for a
perfect coherence. And since we have no extraneous noise in this Problem,
the coherence should equal unity.
You may ask yourself: are these subtle errors in the coherence really
of any importance or is it just snobbery? The answer is, that these errors
are important to identify in real measurement cases as they result in biased
FRF estimates. In real measurement cases it is usually very clear when the
blocksize is made long enough, that suddenly the coherence goes from a rather
poor state to becoming one over the entire frequency range. Thus you need
to be aware of this type of error and make sure you avoid it!
Problem 13.4. This Problem illustrates the effect of the H1 estimator when
Displacement [mm]
Displacement [mm]
0.5 0.5
0 0
−0.5 −0.5
0 5 10 0 10 20
Time [s] Time [s]
−2 −2
10 10
FRF [m/N]
FRF [m/N]
−4 −4
10 10
−6 −6
10 10
0 20 40 60 80 0 20 40 60 80
Frequency [Hz] Frequency [Hz]
Coherence [−]
Coherence [−]
1 1
0.995 0.995
0 20 40 60 80 0 20 40 60 80
Frequency [Hz] Frequency [Hz]
Problem 13.5. To solve the same example as in Problem 13.4, but with
burst random excitation instead, can be accomplished by the following lines
of code. A special note should be made about the ‘amount’ of noise as specified
in the Problem. The most realistic way to define the noise so that it can be
compared with the results of pure random excitation, is to use the same RMS
level (for the same excitation, level, of course). This can be accomplished if
the script for Problem 13.4 saves the generated noise, or its RMS level, so
that this level can be read by the script for the present problem.
The obvious result, when comparing with pure random excitation, is that the
bias error, causing the coherence to dip around the resonances in the case of
pure random excitation, is not present for burst random. This is a result of
the reduced bias with the latter method. It should be realized, though, that the
bias error can be removed also for pure random excitation, by using a very
long blocksize. Try that in the previous problem!
1 [Gxx,Gyx,Gyy,f]=time2xmtrx(xt,yt,fs,ahann(Nt));
2 [Hhann,Chann]=xmtrx2frf(Gxx,Gyx,Gyy);
3 [Gxx,Gyx,Gyy,f]=time2xmtrx(xt,yt,fs,hsinew(Nt),67);
4 [Hhsine,Chsine]=xmtrx2frf(Gxx,Gyx,Gyy);
Multiple-input Frequency
Response Measurement
Problem 14.1. It certainly can, although due to the bias error, very large
blocksizes need to be used compared to if self-windowing excitation signals are
used. If the choice is free, burst random is to prefer.
{Y } = [H] ({X} − {M }) .
where the zero term comes from the cross-spectral density between signals x
and m, which equals zero because those signals are uncorrelated. Finally, we
can thus obtain the H2 estimator for the frequency response as
which can only be solved if the matrix [Gxy ] is invertible, which means, first
of all, it must be square. Thus the number of inputs must equal the number
of outputs.
As a small sidenote, although the H2 estimator only works when the num-
ber of inputs equals the number of outputs, this does, of course, not limit its
57
Solutions to Book Problems
use to this very rare case. If the system has more outputs than inputs, you
can, of course, divide the outputs into a number of groups, each of which con-
tains as many outputs as there are inputs. Then you can estimate the FRFs
of each set of outputs using the H2 estimator. This estimator, however, still
remains relatively rarely used – perhaps partly due to this hassle.
Problem 14.3. This problem can be solved by using the code below plus some
plotting. It should be noted that with the blocksizes in the code, 2, 4, and 8K,
the peaks of the first mode will all be approximately the same height, so it
seems there is no leakage. Since the excitation is pure random, however, this
does not necessarily work. If you look at the coherence you see that there is
actually a dip in the coherence due to the blocksize being too short. You will
need to increase it to 32K for the dips in the coherence to (almost) disappear.
Problem 14.4. If the code in the previous problem to create the system is
used, the following lines can be used to compute FRFs for some different
burst lengths.
1 BurstLength=[50 70 90];
2 % Estimate FRFs and coherence for each blocksize
3 for n=1:length(BurstLength)
4 BL=BurstLength(n);
5 x(:,1)=abrand(N,50,BL);
6 x(:,2)=abrand(N,50,BL);
7 % Compute the response
8 y=timefresp(x,fs,poles,V,[1:2],[1:2],'d');
9 [Gxx,Gyx,Gyy,ft]=time2xmtrx(x,y,fs,boxcar(N));
10 [Ht,Ct]=xmtrx2frf(Gxx,Gyx,Gyy);
11 H{n}=Ht;
12 f{n}=ft;
13 C{n}=Ct;
14 clear x
15 end
Problem 14.5. The following code can be used for the first part of this
Problem (with pure random excitation), assuming the lines defining the sys-
tem in Problem 14.3 have been entered already. Increasing the noise level
by increasing the factor 2e-5 in the code below, you will see the coherence be
increasingly affected, particularly at the high frequencies where the response
is low (because the noise n has constant spectral density).
1 N=16*1024; %
2 % Add pure random noise in both DOFs
3 x=randn(50*N(end),2); % The problem says 100 average: ...
if 50% overlap
4 % Compute the response
5 y=timefresp(x,fs,poles,V,[1:2],[1:2],'d');
6 n=randn(size(y))*2e−5*std(y(:,1));
7 y=y+n;
8 RMSn=std(n(:,1));
9 save noise14.5a RMSn
10 % Estimate FRFs and coherence for each blocksize
11 [Gxx,Gyx,Gyy,f]=time2xmtrx(x,y,fs,ahann(N));
12 [H,C]=xmtrx2frf(Gxx,Gyx,Gyy);
For burst random, the following lines can be used. You should rerun the
first lines and then the following lines after changing the noise levels. With
smaller burst length the signal-to-noise ratio is poorer, which causes a poorer
coherence.
6 x(:,1)=abrand(N,50,BL);
7 x(:,2)=abrand(N,50,BL);
8 % Compute the response
9 y=timefresp(x,fs,poles,V,[1:2],[1:2],'d');
10 load('noise14.5a','−mat')
11 n=randn(size(y))*RMSn;
12 y=y+n;
13 [Gxx,Gyx,Gyy,ft]=time2xmtrx(x,y,fs,boxcar(N));
14 [Ht,Ct]=xmtrx2frf(Gxx,Gyx,Gyy);
15 H{nl}=Ht;
16 f{nl}=ft;
17 C{nl}=Ct;
18 clear x
19 end
Orthogonalization of Signals
Problem 15.1. This Problem can be solved using the following code.
The two loops take approximately the same time, with a slight advantage for
the SVD method. This is due to the extra sort command necessary for the eig
solution. The difference is in the order of 10−16 , i.e. only roundoff errors.
The two methods give ‘ identical’ results.
Problem 15.2. This problem can be solved by the following lines of code.
61
Solutions to Book Problems
The virtual coherence looks ‘weird’, either the one or the other virtual coher-
ence is unity and the other one zero at most frequencies. The reason for this
is, that the principle of principal components is to put the source with maxi-
mum energy at each frequency into the first principal component, etc. In this
case, however, the energy in both sources is equal, and thus it is arbitrary at
each frequency which one ‘wins’. This hardly happens in real life but is still
good to reflect over, if nothing else for demystifying the concept of principal
components.
Problem 16.1. This Problem can be solved by the following code. The re-
sulting shock response spectra should look like those in Figure 16.1
1 fs=2000;
2 f0=2400/60;
3 t=(0:1/fs:1);
4 % Define the periodic signal. Assume "vibration levels" ...
means RMS levels.
5 % It should have been specified in the Problem, see errata ...
list.
6 xp=1/sqrt(2)*(2*sin(2*pi*2*f0*t)+...
7 sin(2*pi*4*f0*t)+0.5*sin(2*pi*6*f0*t));
8 % Compute shock
9 xs=makepulse(length(t),fs,20e−3,'halfsine');
10 xs=20*xs/max(xs);
11 % Compute SRS of each
12 [Sxp,f]=asrs(xp,fs,5,800,200,10);
13 Sxs=asrs(xs,fs,5,800,200,10);
14 loglog(f,Sxp,f,Sxs)
Apparently the shock is much more severe than the periodic signal.
Problem 16.2. This Problem is losely defined when it comes to the shape etc.
of the pulses. But it is not unrealistic so produce half-sine shaped pulses. If
we use that, the following code produces the envelope spectrum. By adjusting
the bandwidth B variable, different numbers of harmonics can be included.
63
Solutions to Book Problems
2
10
1
10
0
10
−1
10
0 1 2 3
10 10 10 10
Frequency [Hz]
24 B=100;
25 [E,f]=aenvspec(y,fs,16*1024,400,B);
Problem 16.3. The power cepstrum can be computed by the following lines
of code, provided the signal y is already defined as in Problem 16.2. The
cepstrum shows a clear peak at the quefrency 0.05, corresponding to the RPM
of 20 Hz (1200 RPM).
Problem 16.4. This Problem can be solved using the ABRAVIBE toolbox
command psd2time. The following lines of code will produce the requested
signal.
1 fs=2000;
2 N=2000; % Gives 1 Hz resolution
3 f=(0:fs/N:fs/2);
4 P=zeros(length(f),1);
5 P(1:400)=1;
6 P(401:600)=10;
7 P(601:end)=1;
8 P=400*P/(f(2)*sum(P));
9 y=psd2time(P,f,100*N);
10 Gyy=apsdw(y,fs,N);
[1] A. Brandt. Noise and Vibration Analysis – Signal Analysis and Experi-
mental Procedures. John Wiley and Sons, 2011.
67