Commit 18e4f19e authored by Florian Kaltenberger's avatar Florian Kaltenberger

adding files to generate TX files for CORRIDOR

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5084 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent a6fa9935
function [sig, sig_f] = OFDM_TX_FRAME_MIMO(num_carriers,num_zeros,prefix_length,num_symbols_frame,preamble_length,num_ant)
% sig - output signal
% sig_length - output signal length
% num_carriers - number of sub-carriers
% num_zeros - number of zero carriers minus 1 (DC)
% prefix_length - length of cyclic prefix
% num_symbols_frame - number of symbols per OFDM frame
% preamble_length - length of 4-QAM preamble
% numant - number of antennas
num_useful_carriers = num_carriers - num_zeros -1;
if (num_ant ==1)
t_dec = 1;
f_dec = 1;
elseif (num_ant ==2)
t_dec = 1;
f_dec = 2;
elseif (num_ant == 4)
t_dec = 2;
f_dec = 2;
else
error('Only 1, 2 or 4 antennas supported');
end
sig = zeros(num_ant,(num_carriers+prefix_length)*num_symbols_frame);
sig_f = zeros(num_ant,num_symbols_frame,num_useful_carriers);
for a=1:num_ant
for k=(floor((a-1)/2)+1):t_dec:preamble_length
QAM4_preamble = zeros(1,num_useful_carriers);
QAM4_preamble((mod(a-1,2)+1):f_dec:num_useful_carriers) = QAM_MOD(4,floor(256*abs(rand(1,num_useful_carriers/4/f_dec))));
sig(a,(k-1)*(num_carriers+prefix_length)+1:k*(num_carriers+prefix_length)) = OFDM_TX(num_carriers,num_zeros,prefix_length,QAM4_preamble);
sig_f(a,k,:) = QAM4_preamble;
end
for k=preamble_length+1:num_symbols_frame
QAM_data = QAM_MOD(256,floor(256*abs(rand(1,num_useful_carriers))));
sig(a,(k-1)*(num_carriers+prefix_length)+1:k*(num_carriers+prefix_length)) = OFDM_TX(num_carriers,num_zeros,prefix_length,QAM_data);
sig_f(a,k,:) = QAM_data;
end
end
%addpath('../../../openair1/SIMULATION/LTE_PHY/')
%addpath('../../../openair1/PHY/LTE_ESTIMATION/')
%addpath('../../../openair1/PHY/LTE_REFSIG/')
%addpath('../../../targets/ARCH/EXMIMO/USERSPACE/OCTAVE')
nb_rb = 100; %this can be 25, 50, or 100
num_carriers = 2048/100*nb_rb;
num_zeros = num_carriers-(12*nb_rb+1);
prefix_length = num_carriers/4; %this is extended CP
num_symbols_frame = 120;
preamble_length = 120;
% this generates one LTE frame (10ms) full of OFDM modulated random QPSK
% symbols
[s,f] = OFDM_TX_FRAME(num_carriers,num_zeros,prefix_length,num_symbols_frame,preamble_length);
% scale to conserve energy (Matlabs IFFT does not scale)
s=s*sqrt(num_carriers);
% load the LTE sync sequence, upsample it to the right frequency and insert
% it in the first symbol of the frame
primary_synch;
pss0_up = interp(primary_synch0_time,num_carriers/128);
pss0_up_cp = [pss0_up(num_carriers-prefix_length+1:end) pss0_up];
s(1:num_carriers+prefix_length) = pss0_up_cp;
plot(abs(s))
% save for later use (channel estimation and transmission with the SMBV)
save(sprintf('ofdm_pilots_sync_%d.mat',num_carriers),'-v7','s','f','num_carriers','num_zeros','prefix_length','num_symbols_frame','preamble_length');
mat2wv(s, sprintf('ofdm_pilots_sync_%d.wv',num_carriers), 30.72e6/2048*num_carriers, 1)
%addpath('../../../openair1/SIMULATION/LTE_PHY/')
%addpath('../../../openair1/PHY/LTE_ESTIMATION/')
%addpath('../../../openair1/PHY/LTE_REFSIG/')
%addpath('../../../targets/ARCH/EXMIMO/USERSPACE/OCTAVE')
% load the LTE sync sequence
primary_synch;
%% this generates one LTE frame (10ms) full of OFDM modulated random QPSK symbols
nb_rb = 100; %this can be 25, 50, or 100
num_carriers = 2048/100*nb_rb;
num_zeros = num_carriers-(12*nb_rb+1);
prefix_length = num_carriers/4; %this is extended CP
num_symbols_frame = 120;
preamble_length = 120;
[s1,f1] = OFDM_TX_FRAME(num_carriers,num_zeros,prefix_length,num_symbols_frame,preamble_length);
% scale to conserve energy (Matlabs IFFT does not scale)
s1=s1*sqrt(num_carriers);
% upsample PSS to the right frequency and insert it in the first symbol of the frame
pss0_up = interp(primary_synch0_time,num_carriers/128);
pss0_up_cp = [pss0_up(num_carriers-prefix_length+1:end) pss0_up];
s1(1:num_carriers+prefix_length) = pss0_up_cp;
%% and now the other carrier
nb_rb = 50; %this can be 25, 50, or 100
num_carriers = 2048/100*nb_rb;
num_zeros = num_carriers-(12*nb_rb+1);
prefix_length = num_carriers/4; %this is extended CP
[s2,f2] = OFDM_TX_FRAME(num_carriers,num_zeros,prefix_length,num_symbols_frame,preamble_length);
% scale to conserve energy (Matlabs IFFT does not scale)
s2=s2*sqrt(num_carriers);
% upsample PSS to the right frequency and insert it in the first symbol of the frame
pss0_up = interp(primary_synch0_time,num_carriers/128);
pss0_up_cp = [pss0_up(num_carriers-prefix_length+1:end) pss0_up];
s2(1:num_carriers+prefix_length) = pss0_up_cp;
%% combine the two carriers
f1_shift = -7.5e6;
f2_shift = 7.5e6;
sample_rate = 30.72e6*2;
s1_up = interp(s1,2);
s1_shift = s1_up .* exp(2*1i*pi*f1_shift*(0:length(s1_up)-1)/sample_rate);
s2_up = interp(s2,4);
s2_shift = s2_up .* exp(2*1i*pi*f2_shift*(0:length(s2_up)-1)/sample_rate);
s = s1_shift + s2_shift/sqrt(2);
plot(abs(fftshift(fft(s))))
%% save for later use (channel estimation and transmission with the SMBV)
save('ofdm_pilots_sync_30MHz.mat','-v7','s','f','num_carriers','num_zeros','prefix_length','num_symbols_frame','preamble_length');
mat2wv(s1, 'ofdm_pilots_sync_30MHz.wv', sample_rate, 1);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment