Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
акустика / lin_h_bengisu_t_mourelatos_zp_lecture_notes_on_acoustics_and.pdf
Скачиваний:
84
Добавлен:
04.05.2023
Размер:
12.68 Mб
Скачать

Appendices

Appendix 1: Discrete Fourier Transform

In Chap. 9, sound pressure functions expressed with frequency contents were given without explaining how to calculate them. Appendix 1 will demonstrate how to convert a time domain function to a frequency domain function using the discrete Fourier transform. This appendix can ll the gap between the time domain function and frequency domain function in Chap. 9.

Discrete Fourier Transform

Fourier Series for Periodical Time Function

The Fourier series for a periodical time function (T¼period) can be formulated as:

1

pðtÞ ¼ Po þ X e jωk tPk þ e jωk tPk k¼1

1

¼ Ao þ X ðAk þ jBkÞe jωk t þ ðAk jBkÞe jωk t

k¼1

1

X

¼ Ao þ 2 ½Ak cos ðωktÞ Bk sin ðωktÞ&

k¼1

where:

© The Author(s), under exclusive license to Springer Nature Switzerland AG 2021

359

H. Lin et al., Lecture Notes on Acoustics and Noise Control, https://doi.org/10.1007/978-3-030-88213-6

360

 

 

 

 

 

 

 

 

 

Appendices

 

 

Pk Ak þ jBk ¼ T Z0

T

 

 

 

 

 

 

 

pðtÞe jωk tdt

 

 

 

 

 

 

1

 

 

 

 

 

 

 

ωk ¼ k

2π

¼ k ω ¼ 2π k f ,

 

2π

,

1

 

 

ω ¼

 

f ¼

 

 

T

T

T

Formulas of Discrete Fourier Series

In general application, p(t) is given as pi ¼ p(ti) ¼ p(i t) for i ¼ 0, 1, . . ., N 1, and N ¼ T/ t. Then, the integration for Pk can be changed to summation as follows:

 

1

 

N 1

 

jωk ti

 

 

1

 

 

N 1 jk

2π

i t

 

 

 

 

 

N t

1

 

X

0 pie

j

N

 

 

 

 

1X

i 0 pie ð Þ

Pk Ak þ jBk ¼ N t

i

¼

 

 

 

t ¼ N

 

 

 

 

 

 

 

 

 

 

ki

 

 

 

 

 

¼

 

 

¼ N Xi¼0

pihe ð

2π

Þi

¼ N dk

 

 

 

 

 

 

 

N 1

 

 

 

 

 

 

 

 

 

 

 

 

where:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

N 1

 

 

 

j

2Nπ

Þi

ki

 

 

 

 

 

dk ¼ Xi¼0

pihe ð

 

 

 

 

 

 

 

is called the discrete Fourier transform (DFT) and can be computed by using the fft function in MATLAB as follows:

½dk& ¼ fftðpi, NÞ

and therefore:

Pk Ak þ jBk ¼ dk=N ¼ fftðpi, NÞ=N

Example 1: The Cosine Function as Sound Pressure

A pure tone acoustic pressure p(t) of frequency f ¼ 500 [Hz] and amplitude P ¼ 3 [Pa] is transformed into the frequency domain for calculating the A-weighted sound pressure level [dBA]:

pðtÞ ¼ P cos ð2πftÞ

Given:

(a) The number of discretized time domain data is N ¼ 16.

(b) The time increment of time domain data is t ¼ 0.000125 [s].

(c) The time domain pressure (n data) which is the input data for MATLAB fft:

Appendices

361

Time domain pressure [Pa]

30 2.772.12 1.15 00 -1.15 -2.12 -2.77 -3-2.77 -2.12 -1.15 00 1.152.12 2.77

(d)The output from the MATLAB fft function is in the frequency domain, and there are N data as shown below:

Real part coefcients [Pa] of Pk ¼ fft( pi, N)/N

0

1.50

0

0

0

 

0

 

0

 

0

0

0

0

0

0

0

0

 

1.50

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Imaginary part coefcients [Pa] of Pk ¼ fft( pi, N)/N

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

0

0

 

0

 

0

 

0

0

 

0

0

0

 

0

 

0

 

0

 

0

 

0

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The Pk can be computed by using the fft function in MATLAB as follows:

Pk Ak þ jBk ¼ dk=N ¼ fftðpi, NÞ=N

Calculate:

The RMS pressure square of the given sound pressure p(t)

The A-weighted sound pressure level

Example 1: Solution

Procedures

Step 1 Calculate the total time:

T ¼ t N ¼ 0:000125½s& ∙ 16 ¼ 0:002 ½s&

 

Step 2

Calculate the frequency increment

f:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

, N

t

f ¼ 1

 

 

 

 

 

 

 

 

 

 

 

1

 

1

 

 

 

 

1

 

 

½Hz& ¼ 500 ½Hz&

 

 

 

 

 

 

 

!

f ¼

 

 

 

¼

 

 

¼

 

 

 

 

 

 

 

 

 

N

 

t

T

0:002

 

 

 

 

Step 3

Indicate frequency values to the frequency domain contents:

 

 

 

Real part coefcients [Pa]: Ak ¼ Re (Pk)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

1.50

0

0

 

0

 

0

 

0

 

 

0

 

 

0

 

0

 

0

0

0

0

0

1.50

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Imaginary part coefcients [Pa]: Bk ¼ Im (Pk)

 

 

 

 

 

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

362 Appendices

Frequency [Hz]

0

500

1000

1500

2000

2500

3000

3500

4000

4500

5000

5500

6000

6500

7000

7500

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Step 4 Calculate the Nyquist frequency fN:

f N ¼

1

 

1

¼

N 1

¼

16

1

¼ 4000 ½Hz&

t

2

T

 

2

 

0:002

2

Step 5 Replace frequencies after the Nyquist frequency with:

f k ¼ f k 2 f N ¼ f k 8000

Real part coefcients [Pa]: Ak ¼ Re (Pk)

0

 

 

1.50

 

 

0

 

0

 

0

 

0

 

 

0

 

 

0

 

 

0

 

 

0

 

 

0

 

0

0

 

0

 

0

 

0

 

1.50

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Imaginary part coefcients [Pa]: Bk ¼ Im (Pk)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

0

 

0

 

0

 

0

 

 

 

0

 

0

 

0

 

0

 

0

 

0

 

0

 

0

 

0

 

0

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Frequency [Hz]: fk ¼

f k

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

500

1000

1500

2000

2500

 

3000

 

3500

 

4000

 

-3500

 

 

-3000

-2500

-2000

-1500

-1000

 

-500

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4

 

 

 

 

Data Time

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

-2

 

 

 

 

 

 

 

 

 

 

-4

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2

0

 

 

 

 

Data Freq (Real)

 

 

 

x 10-3

 

 

 

 

 

 

 

 

4

 

 

 

 

 

 

 

 

2

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

-2

 

 

 

 

 

 

 

 

-4

1000

2000

3000

4000

5000

6000

7000

8000

0

4

 

 

Data Freq (Imag)

 

 

 

 

 

 

 

 

 

 

 

2

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

-2

 

 

 

 

 

 

 

 

-4

1000

2000

3000

4000

5000

6000

7000

8000

0

Appendices

363

Remarks

Make sure that these are complex conjugate pairs.

Make sure that Ak ¼ 1 is the coefcient of the cosine function:

1

pðtÞ ¼ Ao þ 2 X ½Ak cos ðωktÞ Bk sin ðωktÞ& ¼ 3 cos ð2π ∙ 500 tÞ½Pa&

k¼1

Step 6 Calculate the RMS pressure square:

1

Ak2 þ Bk2

 

¼ 2 1:52

þ 02

¼ 4:5

Pa2

 

pRMS2 = Ao2 þ 2

 

 

X

 

 

 

 

 

k¼1

Step 7 Calculate the A-weighted sound pressure level:

Lp ¼ 20 log 10

 

PRMS,500Hz

þ 10 log 10ðW500HzÞ

Pr

q

0 1

2 1:52

¼20 log 10@ 20E 6 A½dB& 3:2 ½dB&

¼97:3 ½dB&

364

Appendices

FFT Using MATLAB fft Function

clear all f=500; % Hz P=3; % Pa T=1/f; % s

N=16; % number of data

%

dt=T/N; % time increment df=1/T; % frequency increment DataTime(:,1)=(0:1:N-1)*dt;

DataTime(:,2)=cos(2*pi*f*DataTime(:,1))*P;

%Discrete FFT based on the Fourier series formula DataFreq(:,1)=(0:1:N-1)*df; DataFreq(:,2)=fft(DataTime(:,2),N)/N;

%get the real and imaginary parts DataFreq(:,3)=real(DataFreq(:,2)); % real part DataFreq(:,4)=imag(DataFreq(:,2)); % imaginary part

%plot results

subplot(3,1,1); plot(DataTime(:,1),DataTime(:,2),'-ok','LineWidth',2,'MarkerSize',4); title('Data Time'); xlabel('time [s]'); YLIM([-4 4]);

subplot(3,1,2); plot(DataFreq(:,1),DataFreq(:,3),'-ok','LineWidth',2,'MarkerSize',4); title('Data Freq (Real)'); xlabel('frequency [Hz]'); YLIM([-4 4]) subplot(3,1,3); plot(DataFreq(:,1),DataFreq(:,4),'-ok','LineWidth',2,'MarkerSize',4); title('Data Freq (Imag)'); xlabel('frequency [Hz]'); YLIM([-4 4]) % save the figure

saveas(gcf,'fig','emf')

Example 2: The Sine Function as Sound Pressure

A pure tone acoustic pressure p(t) of frequency f ¼ 1000 [Hz] and amplitude P ¼ 7 [Pa] is transformed into the frequency domain for calculating the A-weighted sound pressure level [dBA]:

pðtÞ ¼ P sin ð2πftÞ

Appendices

365

Given:

(a)

The number of discretized time domain data is N ¼ 16.

(b)

The time increment of time domain data is t ¼ 0.000125 [s].

(c) The time domain pressure (n data) which is the input data for MATLAB fft: Time domain pressure [Pa]

3 0 4.95 7 4.95 0 -4.95 -7 -4.95 0 4.95 7 4.95 0 -4.95 -7 -4.95

(d)The frequency domain (N data) which is the output from the MATLAB fft function:

Real number part coefcients [Pa] of Pk ¼ fft( pi, N)/N

0 0

0 0

0 0

0

0 0

0

0 0

0

0

0

0

0

0

0

0

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Imaginary number part coefcients [Pa] of Pk ¼ fft( pi, N)/N

0 0

0

0 -3.5

0 0

0

0 0

0 0

0 0

0 0

0 0

0 0

0 0

0 0

0 0

0 3.5

0 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Calculate:

The RMS pressure square of the given sound pressure p(t)

Example 2: Solution

Procedures

Step 1 Calculate the total time:

T ¼ t N ¼ 0:000125 ½s& ∙ 16 ¼ 0:002 ½s&

Step 2 Calculate the frequency increment

f:

 

 

 

, N

t f ¼ 1

 

1

1

 

1

½Hz& ¼ 500 ½Hz&

!

f ¼

 

 

¼

 

 

¼

 

N

t

T

0:002

Step 3 Indicate the frequency values to the frequency domain contents: Real number part coefcients [Pa]: Ak ¼ Re (Pk)

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Imaginary number part coefcients [Pa]: Bk ¼ Im (Pk)

0

0

-3.5

0

0

0

0

0

0

0

0

0

0

0

3.5

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

366 Appendices

Frequency [Hz]

0

500

1000

1500

2000

2500

3000

3500

4000

4500

5000

5500

6000

6500

7000

7500

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Step 4 Calculate the Nyquist frequency, fN:

f N ¼

1

 

1

¼

N 1

¼

N 1

¼

16

1

¼ 4000 ½Hz&

t

 

2

T

 

2

 

T

 

2

 

0:002

2

Step 5 Replace frequencies after the Nyquist frequency with:

f k ¼ f k 2 f N ¼ f k 8000

Real part coefcients [Pa]: Ak ¼ Re (Pk)

0

 

 

0

 

0

 

0

 

 

0

 

 

0

 

 

0

 

0

 

0

 

 

0

 

 

0

 

 

0

 

 

0

 

 

0

 

 

0

 

 

0

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Imaginary part coefcients [Pa]: Bk ¼ Im (Pk)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

0

 

-3.5

 

 

0

 

0

 

 

0

 

 

0

 

 

0

 

 

 

0

 

 

0

 

 

0

 

 

0

 

 

0

 

 

0

 

3.5

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Frequency [Hz]: fk ¼

f k

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

500

1000

1500

 

2000

 

2500

 

3000

 

3500

 

 

4000

 

-3500

-3000

-2500

-2000

-1500

-1000

-500

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Data Time

10

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

-10

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2

0

 

 

 

 

 

time [s]

 

 

 

 

-3

 

 

 

 

 

 

 

 

 

 

x 10

Data Freq (Real)

4

2 0 -2

-4 0 1000 2000 3000 4000 5000 6000 7000 8000

frequency [Hz]

Data Freq (Imag)

4

2 0 -2

-4

0

1000

2000

3000

4000

5000

6000

7000

8000

 

 

 

frequency [Hz]

 

 

 

Appendices

367

Remarks

Make sure that these are complex conjugate pairs.

Make sure that Bk ¼ 2 is the coefcient of the sine function:

1

pðtÞ ¼ Ao þ 2 X ½Ak cos ðωktÞ Bk sin ðωktÞ& ¼ 7 cos ð2π ∙ 1000 tÞ½Pa&

k¼1

Step 6 Calculate the RMS pressure square:

1

Ak2

þ Bk2

 

¼ 2 02 þ ð 3:5Þ2

 

Pa2

 

¼ 24:5

Pa2

 

pRMS2 =Ao2 þ 2 k¼1

 

 

 

X

 

 

 

 

 

 

 

Step 7 Calculate the A-weighted sound pressure level:

 

 

 

P

,1000Hz

 

 

 

Lp ¼ 20 log 10

 

 

RMS

 

 

 

 

þ 10 log 10ðW1000HzÞ

 

 

Pr

 

 

 

 

¼

 

0

q

 

½

&

 

 

 

 

 

1½ & þ

 

20 log 10

 

 

 

2 3:52

 

 

 

dB

0

dB

 

@

20E

 

 

A

 

 

 

 

 

6

 

 

 

 

 

¼ 108 ½dB&

Example 3: Calculating Sound Pressure Level

Given:

The single-frequency pressure is:

pðx, tÞ ¼ P1 cos ð2π f 1tÞ

where:

P1 ¼ 3 ½Pa&

f 1 ¼ 500 ½Hz&

The RMS pressure square can be calculated in the time domain (Example 12.1) as:

1

T

 

1

T

 

P2

 

32

 

pRMS2 =

 

Z0

p2

ðtÞdt =

 

Z0

P12 cos 2ð2π f 1tÞdt =

1

¼

 

Pa2

T

T

2

2

or in the frequency domain (Example 12.3) as: