Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
sampling frequency and psd

Subject: sampling frequency and psd

From: MICHAEL

Date: 19 Jul, 2009 18:00:03

Message: 1 of 2

Hi!

i generate some signal in frequency domain, transfer it to time domain and doing the PSD on the time domain signal.

i have 2 little problems:
1. when i increse the sampling frequency, i get PSD decreased.
2.the psd has 2 strong bins, but i don't understand why.

the code:

fm=7;
Fs = 1e4;
FreqLength=1e5;
f = ((0:FreqLength-1)-FreqLength/2)*Fs/FreqLength;

channel_freq=(abs(f)<fm)/(2*fm);

plot(f,channel_freq);

NFFT = 2^nextpow2(length(channel_freq));
y_time=ifft(ifftshift(channel_freq),NFFT);
figure;
n = 0:NFFT-1;
t = (n -NFFT/2)/ Fs*FreqLength/NFFT;
plot(t,fftshift(abs(y_time)));

h = spectrum.welch; % Create a Welch spectral estimator.
Hpsd = psd(h,y_time,'SpectrumType','twosided','CenterDC',true); % Calculate the PSD
figure, plot(Hpsd);title('First tap PSD');

Subject: sampling frequency and psd

From: Greg

Date: 20 Jul, 2009 05:32:53

Message: 2 of 2

On Jul 19, 2:00 pm, "michael" <bezen...@gmail.com> wrote:
> Hi!
>
> i generate some signal in frequency domain, transfer it to time domain and doing the PSD on the time domain signal.
>
> i have 2 little problems:
> 1. when i increse the sampling frequency, i get PSD decreased.

The PSD in pwelch and periodogram are scaled by 1/Fs.
See my post on Power Spectrum Scaling
http://groups.google.com/group/comp.soft-sys.matlab/msg/2222327db2ea7f51

> 2.the psd has 2 strong bins, but i don't understand why.

A single sinusoid will have peaks at +/- f0

Hope this helps.

Greg
>
> the code:
>
> fm=7;
> Fs = 1e4;
> FreqLength=1e5;
> f = ((0:FreqLength-1)-FreqLength/2)*Fs/FreqLength;
>
> channel_freq=(abs(f)<fm)/(2*fm);
>
> plot(f,channel_freq);
>
> NFFT = 2^nextpow2(length(channel_freq));
> y_time=ifft(ifftshift(channel_freq),NFFT);
> figure;
> n = 0:NFFT-1;
> t = (n -NFFT/2)/ Fs*FreqLength/NFFT;
> plot(t,fftshift(abs(y_time)));
>
> h = spectrum.welch;                  % Create a Welch spectral estimator.
> Hpsd = psd(h,y_time,'SpectrumType','twosided','CenterDC',true);   % Calculate the PSD
> figure, plot(Hpsd);title('First tap PSD');

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us