[RX]
- one leadLag for integer and fractional git-svn-id: http://moon:8086/svn/matlab/trunk@89 801c6759-fa7c-4059-a304-17956f83a07c
This commit is contained in:
+10
-10
@@ -240,8 +240,7 @@ while((fileRemain > fileChunkSize) | (buf_recv.len() > 2*N)) % ToDo: don't leave
|
|||||||
fprintf('Creating Symbols\n');
|
fprintf('Creating Symbols\n');
|
||||||
fprintf('Fine fractional CFO acquisition\n');
|
fprintf('Fine fractional CFO acquisition\n');
|
||||||
delta_theta = 0;
|
delta_theta = 0;
|
||||||
leadLag_f_z = 0;
|
leadLag_z = 0;
|
||||||
leadLag_i_z = 0;
|
|
||||||
end
|
end
|
||||||
kn = fs/(2*pi*(1+Ng/N))/N;
|
kn = fs/(2*pi*(1+Ng/N))/N;
|
||||||
sym_pilot = exp(j*2*pi*phi_pilot'/1024);
|
sym_pilot = exp(j*2*pi*phi_pilot'/1024);
|
||||||
@@ -260,7 +259,9 @@ while((fileRemain > fileChunkSize) | (buf_recv.len() > 2*N)) % ToDo: don't leave
|
|||||||
x = x.*exp(j*(2*pi*df_track/fs*(0:N+Ng-1)' + phi_track));
|
x = x.*exp(j*(2*pi*df_track/fs*(0:N+Ng-1)' + phi_track));
|
||||||
phi_track = mod(phi_track + 2*pi*df_track/fs*(N+Ng), 2*pi);
|
phi_track = mod(phi_track + 2*pi*df_track/fs*(N+Ng), 2*pi);
|
||||||
Fc = exp(j*(2*pi*(0:N-1)/(N)*(sample_offset_fractional)));
|
Fc = exp(j*(2*pi*(0:N-1)/(N)*(sample_offset_fractional)));
|
||||||
X = fft(x(Ng+1:N+Ng)) .* [Fc(N/2:-1:1) Fc(N:-1:N/2+1)].';
|
Fc = [Fc(N/2:-1:1) Fc(N:-1:N/2+1)].';
|
||||||
|
% Fc = 1;
|
||||||
|
X = fft(x(Ng+1:N+Ng)) .* Fc;
|
||||||
X = X .* exp(j*2*pi*(0:N-1)/(N)*(sample_offset_integer)).';
|
X = X .* exp(j*2*pi*(0:N-1)/(N)*(sample_offset_integer)).';
|
||||||
buf_Z.write(X);
|
buf_Z.write(X);
|
||||||
% CFO Fine acquisition
|
% CFO Fine acquisition
|
||||||
@@ -385,20 +386,19 @@ while((fileRemain > fileChunkSize) | (buf_recv.len() > 2*N)) % ToDo: don't leave
|
|||||||
Tgh = floor(Ng/2);
|
Tgh = floor(Ng/2);
|
||||||
Tgs = floor(Ng);
|
Tgs = floor(Ng);
|
||||||
max_delta_theta = Tgh;
|
max_delta_theta = Tgh;
|
||||||
h_absq = abs( ifft( transpose(H)) ).^2; %note thate h_absq is mirrored in time direction because we use fft instead of ifft
|
h_absq = abs( ifft( transpose(H)) ).^2;
|
||||||
h_filter_sto = sin([1:Tgs]/(Tgs+1)*pi).^(0.9);
|
h_filter_sto = sin([1:Tgs]/(Tgs+1)*pi).^(0.9);
|
||||||
[dummy, delta_theta] = max(filter(h_filter_sto , 1, [h_absq,h_absq] ) ); %find a window with maximum energy inside
|
[dummy, delta_theta] = max(filter(h_filter_sto , 1, [h_absq,h_absq] ) ); %find a window with maximum energy inside
|
||||||
delta_theta = ( rem( N + Tgh + 1 - delta_theta + N*1.5, N ) - N/2 )*Tu/N;
|
delta_theta = ( rem( N + Tgh + 1 - delta_theta + N*1.5, N ) - N/2 )*Tu/N;
|
||||||
% delta_theta = sign(delta_theta);
|
% delta_theta = sign(delta_theta);
|
||||||
|
|
||||||
[sample_offset_fractional, leadLag_f_z] = leadLag(delta_theta, 0.01, 0.000, leadLag_f_z);
|
[sample_offset, leadLag_z] = leadLag(delta_theta-sample_offset_integer, 0.01, 0.00, leadLag_z);
|
||||||
[sample_offset_integer, leadLag_i_z] = leadLag(delta_theta-sample_offset_integer, 0.01, 0.00, leadLag_i_z);
|
|
||||||
|
|
||||||
sw_f = 0;
|
sw_f = 1;
|
||||||
sw_i = 1;
|
sw_i = 0;
|
||||||
sample_offset_fractional = sw_f *(sample_offset_fractional - sw_i*floor(sample_offset_fractional));
|
sample_offset_fractional = sw_f *(sample_offset - sw_i*floor(sample_offset));
|
||||||
sample_offset_fractional_ = [sample_offset_fractional_ sample_offset_fractional];
|
sample_offset_fractional_ = [sample_offset_fractional_ sample_offset_fractional];
|
||||||
sample_offset_integer = sw_i*floor(sample_offset_integer);
|
sample_offset_integer = sw_i*floor(sample_offset);
|
||||||
sample_offset_integer_ = [sample_offset_integer_ sample_offset_integer];
|
sample_offset_integer_ = [sample_offset_integer_ sample_offset_integer];
|
||||||
|
|
||||||
% equalize symbol
|
% equalize symbol
|
||||||
|
|||||||
Reference in New Issue
Block a user