Presentation is loading. Please wait.

Presentation is loading. Please wait.

Spectral analysis and discrete Fourier transform Honza Černocký, ÚPGM.

Similar presentations


Presentation on theme: "Spectral analysis and discrete Fourier transform Honza Černocký, ÚPGM."— Presentation transcript:

1 Spectral analysis and discrete Fourier transform Honza Černocký, ÚPGM

2 The cosine story … 2

3 Argument of the cosine 0 … 2  and then every 2  3 the period

4 Discrete time cosine Task #1: generate a cos, with 1 period per second on sampling frequency F s 4

5 Discrete time cosine Task #2: generate a cos, with 2 periods per second on sampling frequency F s 5

6 Discrete time cosine Task #3: Generate a cosine that will do 440 periods per second on sampling frequency F s - chamber „a“ 440Hz. 6

7 Check in Matlab Generate, Measure 1 period (by hand!) Compute period and frequency Play it ! DEMO 1 in Matlab 7

8 Normalized frequency Unit ? Examples ? 8

9 General cosine Units ? 9 magnitudenormalized frequency initial phase

10 Initial phase I. 10

11 Initial phase II. 11

12 A little song … DEMO 2 in Matlab Lengths and durations of notes FUJ  12

13 Real world signals Signal and spectrum a-open-string_16bit.wav (WS) Physics – see for example https://www.youtube.com/watch?v=BSIw5Sg Uirg (all vibration modes together) https://www.youtube.com/watch?v=BSIw5Sg Uirg 13

14 Real world signals Signal and spectrum fletna.wav (WS) Physics – see for example https://www.youtube.com/watch?v=KZ7int Mz2Y4 (all vibration modes together) https://www.youtube.com/watch?v=KZ7int Mz2Y4 14

15 Real world signals Signal and spectrum test.l16 (WS) Physics – see for example https://www.youtube.com/watch?v=y2okeYVc lQo (flapping of vocal cords produces lots of harmonic frequencies …) https://www.youtube.com/watch?v=y2okeYVc lQo 15

16 Seismology … 16

17 Vibration analysis http://www.dsi-hums.com/honeywell-zing- test/8500-c-plus/http://www.dsi-hums.com/honeywell-zing- test/8500-c-plus/ 17

18 Spectral analysis for what ? I. Visualize… 18

19 Spectral analysis for what ? II. Measure / detect / recognize 19

20 Spectral analysis for what ? III. Filtering y[n] = x[n] * h[n] y[n] = F -1 [ F(x[n]) F(h[n])] 20

21 Spectral analysis Correlation Determination of similarity Projection to bases 21 The same ! }

22 Examples of analysis Signal with N=100 samples Let’s begin with a D.C. signal … 22

23 Another D.C. 23

24 Cosine with a D.C. component 24

25 Cosine around zero 25

26 Cosine with a minus D.C. component 26

27 Now with something else The analyzing signal will do 3 periods in 100 samples. Generating it ? 27

28 DC … 28

29 Another (the same) cosine 29 Will the D.C. have any influence ?

30 Cosine with noise 30

31 Cosine with minus sign 31

32 What do the coefficients tell us Big positive – correlation, similarity, this frequency IS in the analyzed signal. Big negative – anti-correlation, similar, but in the inverse sense, the frequency IS in the analyzed signal with minus sign. Small / zero – no correlation, no similarity, the frequency is not there or just a little. 32

33 Let’s analyze something more complicated WS: signal.wav Basic period 100 samples –How much is this in Hz ? Lots of harmonics colored by speech sound “a” –Geeks, see spec_matlab.m 33

34 Not one but whole group of cosines DEMO 3 in Matlab Until which frequency should we run ? 34

35 Analysis by all this 35

36 The results and re-synthesis still DEMO 3 … –Plot of the results –Or of their absolute values –Synthesis from the coefficients… HM HM …  36

37 What’s the problem ?? 37

38 38

39 Phase is the problem ! 39 How come it’s zero when

40 We’ll need also the sines … DEMO 4 in Matlab Get coefficient a by a projection to cos Get coefficient b by a projection to sin How will sqrt(a 2 + b 2 ) look like ? 40

41 Analysis with whole groups of cosines and sines How will the analysis signals for limit values look like ? 41

42 Let’s go 42

43 How did it work DEMO 5 in Matlab –Visualizationí –Re-synthesis Nice 43

44 cos and sin in one function – complex exponentials The meaning of |X k | … and arg(X k ) ? What is k ? 44

45 This veeeery complicated maths 45

46 Discrete Fourier transform What is what ? –x[n] and n –X[k] and k –k/N and multiplication by 2  46

47 DFT in matrix way 47

48 How does complex exponential look like ? DEMO 6 in Matlab Physical model Make one yourself ! 48

49 Use of DFT Select N samples out of your signal (good if it is a power of 2) Call it ( fft, ne dft …) Limit samples to 0…N/2 Visualize it 49

50 A nice frequency axis DEMO 7 in Matlab Frequency axis –Indices 0 … N-1 –Normlized frequencies 0/N … (N-1)/N –Real frequencies 0 … almost F s –And attention, most often, we want to see just N/2+1 samples 50

51 Inverse DFT Pokračování DEMO 7 51

52 SUMMARY We analyze by multiplying and adding 7 Difficult signals are analyzed by harmonically related functions –Cosines – not enough –Cosines and sines –But even better complex exponentials => DFT The results are there for N discrete frequencies from 0 till almost F s –Of these, only N/2+1 are worth showing –But with a nice frequency axis ! 52

53 TO BE DONE How is it with the phases ? Why this minus sign ? How is it possible, that the inverse DFT processes complex coefficients, the functions are complex too, and still it produces a real signal ? What to do if we need more points than N (making the plot more beautiful ?) Answers –Continuation of ISS –Or self-thinking supported by literature and online sources. 53

54 The END 54


Download ppt "Spectral analysis and discrete Fourier transform Honza Černocký, ÚPGM."

Similar presentations


Ads by Google