Cross-Correlation between signal and the delay version

Status
Not open for further replies.

arash rezaee

Member level 5
Joined
Sep 10, 2009
Messages
87
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,952
Hi everyone. I have an OFDM signal and I simulated my feedback signal with delay version of input signal. So now I want to calculate the amount of delay. I know we can do it with matlab function xcorr but I want to do it with FIR filter which the coefficients are the reverse of input signal. I calculate with both Xcorr function and with FIR filter but the FIR filter answer is not correct!!!!!!!!!! what can I do? Please help me guys. Here is my code:

T = (7e-6/64)/2;
Fs = 1/T;

ofdm_symbol = func_ofdm_generate('16qam', '8k', 1/32, 1);
x = abs(ofdm_symbol)/max(abs(ofdm_symbol)) .* exp(j*phase(ofdm_symbol));
R_input = real(x);
I_input = imag(x);
h = dfilt.delay(5); %make delay version
FB = filter(h,x);
R_FB = real(FB);
I_FB = imag(FB);

xcorr_signal=filter(conj(R_input(64:-1:1)),1,R_FB(1:1:64));
%D = finddelay(R_input,R_FB);
K=xcorr(R_input(1:64),R_FB(1:64));%calculate by matlab function
delay1 = 64-(find(K==max(K)));
delay2 = 64-(find(xcorr_signal==max(xcorr_signal)));

Best Regards,

Arash
 

Hi Arash,

I try to run your code on my machine but got the error 'func_ofdm_generate' not found.....Can you post the code for this function such that I can run it and give you the feedback

Also, you are using a function 'finddelay' ....however it is in comments... can you put that code too.....

with regards,

milind
 

Hi here is the code for OFDM Function. By the way the finddelay is matlab function.

function y = func_ofdm_generate(qam_mode, ofdm_mode, GI, N_symbol)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
switch qam_mode
case 'qpsk'; M = 4; case '16qam'; M = 16; case '64qam'; M = 64;
end

switch ofdm_mode
case '2k'; N_fft = 2048*2; n = 1705;
case '4k'; N_fft = 2048*4; n = 3409;
case '8k'; N_fft = 2048*8; n = 6817;
end

scale = modnorm(qammod(0:M-1,M),'peakpow',1) ;
data = randi([0,M-1],1,N_symbol*n);
data_qam = scale * qammod(data,M);
x = reshape(data_qam,n,N_symbol);
y = [x((n-1)/2+1:end,;zeros(N_fft-n,N_symbol);x(1n-1)/2,];
Y = ifft(y, N_fft);
Y1 = [Y(end-GI*N_fft+1:end,;Y];
y = reshape(Y1,1,N_symbol*N_fft*(1+GI));

Thanks
 

hiii Sorry once again ....


I could not found function 'modnorm' and 'qammod' in the function func_ofdm_generate....... Please post your complete code then only one can run this and give you some feedback.....


Sorry for that I went to mathworks site I think these are the function from "Communications System Toolbox" ...... I don't have that with me.....I will not be able to help you out

Also you are using 'dfilt' from 'Signal Processing Toolbox'.... that also I even do not have.....

Only one thing I can tell from my signal processing background and after going through your code...... you want to do cross-correlation..... and as I understand your code the input and feedback both signal are complex number array...why are you only operating on the real parts of it..... I mean if you want to do cross-correlation ..... I think what you can do is flip the signal ( not the complex number signal but the real value signals generated before even converting it to complex number array ) and then convert it to complex number based transform and them do the dot multiplication ...... as correlation will be done by means of convolution in frequency domain..... I hope you understand what I mean.....

With regards,

Milind
 
Last edited:

Ok. just ignore the ofdm generation and just add random matrix and then delay it. again you can see the output of filter is not equal to delay I just added. Please comment OFDM generator and try to add one matrix by your self.

Regards
Arash
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…