  Forum Pages: 1 Power spectrum of sinusoid processed with a Hann window has multiple traces? (Read 2401 times)
 petitivoire New Member Offline Posts: 5 Power spectrum of sinusoid processed with a Hann window has multiple traces? Apr 05th, 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 matlab2)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 exampledeltaT=0.001;%time between samplesfs=1/deltaT; %sampling frequencyFFTOSR=64;%extra OSR for fftOSR=fs/(2*fbw);%sampling OSRNFFT=2048;%size of FFTnVals=fs*(-NFFT/2:NFFT/2-1)/NFFT;%Normalizing expressioncycle=5;period=1/fbw;t = 0:deltaT:cycle*period;freq=[0:fs:1/(cycle*period)];x = sin(2*pi*fbw*t);%signal to be sampledsubplot(4,1,1);y = x;L=length(y);plot(y);grid ontitle(['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 plotV=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! Back to top  IP Logged Pages: 1