The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Analog Verification >> Analog Performance Verification >> Power spectrum of sinusoid processed with a Hann window has multiple traces?
https://designers-guide.org/forum/YaBB.pl?num=1428254448

Message started by bouehou on Apr 5th, 2015, 10:20am

Title: Power spectrum of sinusoid processed with a Hann window has multiple traces?
Post by bouehou on Apr 5th, 2015, 10:20am

Hi All,


This is my first ADC and verifying it is proving to be more difficult then actually designing the sub-blocks.
I have been able to do a transient simulation in cadence (
Spectre) and have successfully imported the data into matlab.
This is where I'm encountering most of my headache.

1) I'm new at matlab

2)All of the fft examples I've seen use as input a time varying signal defined as a function. The data that I have is in a table form: transient output with respect to time.
Do I have to build a function from the data that I imported?

2) In order to familiarize myself with the procedure of getting my SNR I've used an ideal sinusoid as an example and gone all the way up to applying a Hann window to the signal.

I'm hoping someone can help me with these questions:

a) Please refer to the attachment: he last plot, is supposed to be the power spectrum of the windowed signal. Can someone explain to me why there are lot of traces of it. Am I doing something wrong or am I wrong to expect a single trace. I'm basically trying to compare the power of the signal in two cases: windowed (with hann) and unwindowed.

b) Ultimately, I'll be extracting the SNR of my real ADC with a hann window applied to the output. What is the ideal bandwidth that I have to consider to do the SNR measurement in?

Here is my matlab code for the attached results:

clear all;
close all;
clf;

fbw=50;%for tutorial example
deltaT=0.001;%time between samples
fs=1/deltaT; %sampling frequency

FFTOSR=64;%extra OSR for fft
OSR=fs/(2*fbw);%sampling OSR
NFFT=2048;%size of FFT

nVals=fs*(-NFFT/2:NFFT/2-1)/NFFT;%Normalizing expression

cycle=5;
period=1/fbw;
t = 0:deltaT:cycle*period;
freq=[0:fs:1/(cycle*period)];
x = sin(2*pi*fbw*t);%signal to be sampled
subplot(4,1,1);
y = x;
L=length(y);
plot(y);
grid on
title(['Sine Wave f=', num2str(fbw), 'Hz']);
xlabel('Time(s)');
ylabel('Amplitude');
%
%FFT and plots
%
Y = fftshift(fft(y,NFFT));
subplot(412);
plot(nVals,abs(Y));
grid on;
title('magnitude of FFT');
xlabel('Frequency(HZ)');
ylabel('Magnitude');

Pyy = (abs(Y).^2) / (NFFT*L);
Pyydb=dbp(Pyy);
subplot(413);
plot(nVals,Pyydb);
title('power over entire spectrum unwindowed');
xlabel('Frequency(HZ)');
ylabel('Power dB');
grid on;


%
%Apply Hann window
%
w=hann(NFFT);
nb=3;
w1=norm(w,1);
w2=norm(w,2);
NBW=(w2/w1)^2;

%FFT of Hann windowed signal and plot
V=fftshift(fft(w*y)/(w1/2));
Pvv = abs(V.^2) / (NFFT*L);
Pvvdb=dbp(Pvv);
subplot(414);
plot(nVals,Pvvdb);

title('power over entire spectrum with hann window');
xlabel('Frequency(HZ)');
ylabel('Power dB');
grid on;

Thanks!

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.