Calculate power spectral density Using FFT and periodic Graph

Source: Internet
Author: User
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 );

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.