This shows you the differences between two versions of the page.
Next revision | Previous revision Last revision Both sides next revision | ||
vpde_lecture34 [2020/04/21 08:38] trinh created |
vpde_lecture34 [2020/04/21 11:25] trinh |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Lecture 34: The maths of music I ====== | ====== Lecture 34: The maths of music I ====== | ||
+ | |||
+ | < | ||
+ | <iframe width=" | ||
+ | </ | ||
===== The Fourier spectra ===== | ===== The Fourier spectra ===== | ||
Line 46: | Line 50: | ||
The last thing I want to show you today is how a computer stores the information of a signal in terms of a Fourier series. Rather than store information about sines and cosines separately, it is more compact to work with complex-valued functions and store the information together. | The last thing I want to show you today is how a computer stores the information of a signal in terms of a Fourier series. Rather than store information about sines and cosines separately, it is more compact to work with complex-valued functions and store the information together. | ||
+ | |||
+ | Matlab uses the fft command to calculate the Fourier series of a signal (technically the discrete Fourier transform). I will not explain it in detail at this point. What you have to understand is that you can put a vector into fft, but to plot the Fourier amplitudes, you need to rearrange the output in a funny way. | ||
+ | |||
+ | < | ||
+ | N = length(f2); | ||
+ | yhat = fft(f2); | ||
+ | A = abs(yhat)/ | ||
+ | K = (Fs/ | ||
+ | A = A(1: | ||
+ | </ |