Hello all,
I want to determine the power level (dB amp) of (supposed to be wgn) random signal using oscilloscope data. I have compiled a code to do the job but when tried to verify my code for several different signals (periodic sinus, random gaussian) generated on MATLAB, I have seen that the code yields different power levels for different signals.
For example:
I have the following:
y10 = 10 periods of a 50 MHz single tone signal samples with 0 dB power sampled at 1 GHz generated by MATLAB,
y50 = 50 periods of a 50 MHz single tone signal samples with 0 dB power sampled at 1 GHz generated by MATLAB,
n4 = 0 dB (Variance=1) random sequence of length 10^4 generated by randn command of MATLAB,
n5 = 0 dB (Variance=1) random sequence of length 10^5 generated by randn command of MATLAB,
n6 = 0 dB (Variance=1) random sequence of length 10^6 generated by randn command of MATLAB,
But when I run my code for each signal to show me the fft plot I come across the following:
My Code is below:
---
clear all;
close all;
set(0,'DefaultFigureWindowStyle','docked');
Fs=1e9;
R=1; %Resistance Value is 1 Ohm for MATLAB generated sequences
n5=randn(1e5,1);
n6=randn(1e6,1);
n4=randn(1e4,1);
y50=1.4142*sin(2*pi*(0:1/20:50));%50 periods of Sine Wave
y10=1.4142*sin(2*pi*(0:1/20:10));%10 periods of Sine Wave
clc
y=n6;
L = length
;
NFFT = (L);
Y= fft(y,NFFT)/(L);
YdB=20*log10(1.4142*abs(Y)/sqrt(R));
f = Fs/2*linspace(0,1,round(NFFT/2)+1);
plot(f/1e6,YdB(1:round(NFFT/2)+1))
title('10^6 Length Random Data Single-Sided Spectrum')
xlabel('Frequency (MHz)')
ylabel('|Y(f)|dBW = 10log(Volt ^2/Ohm)')
---
Why do I see that for increasing length of sequences in the Random Sequences, I loose the power of signal.
I can correct that by dividing fft result by sqrt(L) (in the CODE LINE:Y= fft(y,NFFT)/(L);
but that changes the periodic signal power level then. Why do I see that? What am I doing wrong?