T = 0: 0. 0001:0. 1; % the interval is 0.0001, indicating that the sampling frequency is 127hzx = square (2 * pI * 1000 * t ); % square wave signal N = randn (SIZE (t) with a fundamental frequency of Hz; % white noise F = x; % add white noise figure (1) to the signal; subplot, 1); plot (T, f); % plot the waveform map of the original signal ylabel ('amplitude (v) '); xlabel ('time (s )'); title ('original sign'); y = FFT (F, 1024); % perform discrete Fourier transformation on the original signal. The number of samples participating in the DFT is 1024 subplot (, 2 ); M = ABS (y); F1 = (0: length (y)/2-1) '* 10000/length (y ); % calculate the amplitude plot (F1, M (1: length (y)/2) * 2/length (y) corresponding to the different points after the transformation )); ylabel ('modulus of amplitude '); xlabel ('time (s)'); Title ('fourier transform of the original signal '); % estimate the power spectral density using the Cycle Graph Method P = y. * conj (y)/1024; % calculate the power spectral density FF = 10000 * (0: 499)/1024; % calculate the frequency value corresponding to the different points after the transformation figure (2 ); plot (FF, P (); ylabel ('amplitude '); xlabel ('frequency (HZ)'); Title ('power spectral density (Cyclic plot )');
The problem of ordinate and abscissa during FFT Transformation
Clear all; clcfs = 500; t = ()/Fs; S = cos (2 * pI * 50 * t); n = length (t); figure (1 ), subplot (211); plot (t, s) F = fftshift (FFT (s); subplot (212); plot (-n/2: n/2-1) * fs/N, ABS (f) * 2/N );