This shows you the differences between two versions of the page.
Next revision Both sides next revision | |||
vpde_lecture34 [2020/04/21 08:38] trinh created |
vpde_lecture34 [2020/04/21 08:42] trinh |
||
---|---|---|---|
Line 46: | Line 46: | ||
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: | ||
+ | </ |