why PSD is different?
Afficher commentaires plus anciens
Hello all, I am new to digital signal processing. I understand that there are 2 ways to get the PSD of a signal: 1- by fft the auto-correlation of the signal 2- by multiplying the fft of the signal by its conjugate. when I use these 2 methods in matlab on a maximum-length PRBS signal I always get different results! can you explain it for me ? here is my code:
x=idinput(2^14-1,'PRBS') % prbs
[rxx lags]=xcorr(x)
X=fft(x,length(x))
rxx_temp=rxx(1:(length(x)))
rxx_temp=fliplr(rxx_temp')
rxx=rxx_temp'
Rxx1=fft(rxx)
subplot(211)
plot(abs(Rxx1))
title('S(f)=Rxx(f)=fft(rxx)')
Rxx2= X.*conj(X)
subplot(212)
plot(abs(Rxx2))
title('S(f)=Rxx(f)=X X*')
1 commentaire
Honglei Chen
le 7 Juin 2013
Converted to code format
Réponses (2)
Youssef Khmou
le 7 Juin 2013
hi,
They are the same with your approach here is an example :
x=sin(2*pi*40*(0:1/90:10));
[rxx lags]=xcorr(x)
X=fft(x,length(x))
rxx_temp=rxx(1:(length(x)))
rxx_temp=fliplr(rxx_temp')
rxx=rxx_temp'
Rxx1=fft(rxx)
subplot(211)
plot(abs(Rxx1))
title('S(f)=Rxx(f)=fft(rxx)')
Rxx2= X.*conj(X)
subplot(212)
plot(abs(Rxx2))
title('S(f)=Rxx(f)=X X*')
1 commentaire
Ahmed
le 7 Juin 2013
Gaurav
le 26 Avr 2023
0 votes
clc;
close all;
clear all;
% User Inputs
bit_size=input('Enter the bit size '); % Bit size is taken as input
nf=7; % Flip-flops in LFSR
% Feedback tap positions
taps=[6 7]; % taps in LFSR
ri=randi([0 1],1,nf); % LFSR with random seed inputlr=zeros(1,nf); % LFSR initialization
l=128; % PRBS length
ls=zeros(l,nf); % sequence initialization in LFSR
for i=1:l
% LFSR shift operation
y= sum(ri(taps)); % xor operation output
x= mod(y,2);
lr(2:end) = ri(1:end-1) ; % Shifting in LFSR
lr(1)=x;
% Feedback in LFSR
ri=lr;
% updating value of ri
ls(i,:)=lr;
% generation of LFSR Sequence
end
Catégories
En savoir plus sur Audio Processing Algorithm Design dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!