www.pudn.com > mimoprecoding.rar > codebook_select_interp.m, change:2006-07-20,size:4839b


function [index feedback_bits] = codebook_select_interp(cir,sim_options)
global sim_consts;
[n_tx_antennas, n_rx_antennas] = get_n_antennas(sim_options);
cir = transpose(cir);
[temp_r,temp_c] = size(cir);
cir_f = zeros(64,temp_c);
for i = 1 : temp_c
    cir_f(:,i) = fft(cir(:,i),64);
end
cir_tx = zeros(2*64,temp_c/2);
pattern = [1:2:2*64;2:2:2*64];
for i = 1 : temp_c/2
    cir_tx(pattern(1,:), i) = cir_f(:,i);
    cir_tx(pattern(2,:), i) = cir_f(:,i + temp_c/2);
end
for i = 1 : 64
    for j = 1 : n_rx_antennas
        cir_tx_subc(j,:,i) = cir_tx(j+(i-1)*n_rx_antennas,:);
    end
end
w = sim_consts.beamformingvec;
[temp_r,temp_c] = size(w);
subchannel_cluster_num = 21;   %1 , 3, 9, 21, 63
subchannel_full_feedback_index = [1:subchannel_cluster_num:64];
beta_num = 8;
beta = exp([0:beta_num-1]*2*pi*sqrt(-1)/beta_num);
index = zeros(1,64);
num_extre = size(subchannel_full_feedback_index, 2);
for l = 1 : num_extre
    index_temp = 1;
    max_snr = abs((transpose(w(:,1)) * transpose(cir_tx_subc(:,:,subchannel_full_feedback_index(l))))...
        *(transpose(w(:,1)) * transpose(cir_tx_subc(:,:,subchannel_full_feedback_index(l))))');
    for i = 2 : temp_c
        temp = abs((transpose(w(:,i)) * transpose(cir_tx_subc(:,:,subchannel_full_feedback_index(l))))...
            *(transpose(w(:,i)) * transpose(cir_tx_subc(:,:,subchannel_full_feedback_index(l))))');
        if temp >= max_snr
            index_temp = i;
            max_snr = temp;
        end
    end
    index(subchannel_full_feedback_index(l)) = index_temp;
end
ww = zeros(size(w));
ww(:,subchannel_full_feedback_index)=w(:,index(subchannel_full_feedback_index));

for k = 1 : num_extre-1
    %cluster_index = [subchannel_full_feedback_index(k):subchannel_full_feedback_index(k+subchannel_cluster_num)];
    for l = 2 : subchannel_cluster_num
%         best_beta = ((w(:,index((k-1)*subchannel_cluster_num+1))+exp(sqrt(-1)*beta(1))*w(:,index(k*subchannel_cluster_num+1)))'*...
%             cir_tx_subc(:,:,(k-1)*subchannel_cluster_num + l)'*cir_tx_subc(:,:,(k-1)*subchannel_cluster_num + l)*...
%             (w(:,index((k-1)*subchannel_cluster_num+1))+exp(sqrt(-1)*beta(1))*w(:,index(k*subchannel_cluster_num+1))))/...
%             (norm((w(:,index((k-1)*subchannel_cluster_num+1))+exp(sqrt(-1)*beta(1))*w(:,index(k*subchannel_cluster_num+1))))^2);
%         best = 1;

        w_interpolation = zeros(4,beta_num);
        for i = 1 : beta_num
%             temp = ((w(:,index((k-1)*subchannel_cluster_num+1))+exp(sqrt(-1)*beta(i))*w(:,index(k*subchannel_cluster_num+1)))'*...
%                 cir_tx_subc(:,:,(k-1)*subchannel_cluster_num + l)'*cir_tx_subc(:,:,(k-1)*subchannel_cluster_num + l)*...
%                 (w(:,index((k-1)*subchannel_cluster_num+1))+exp(sqrt(-1)*beta(i))*w(:,index(k*subchannel_cluster_num+1))))/...
%                 (norm((w(:,index((k-1)*subchannel_cluster_num+1))+exp(sqrt(-1)*beta(i))*w(:,index(k*subchannel_cluster_num+1))))^2);
%             if temp > best_beta
%                 best_beta = temp;
%                 best = i;
%             end
            w_interpolation(:,i) = ((1 - l/subchannel_cluster_num)*w(:,index((k-1)*subchannel_cluster_num+1))+...
                     (exp(sqrt(-1)*beta(i))*(l/subchannel_cluster_num)*w(:,index(k*subchannel_cluster_num+1))))/...
                     (norm(((1 - l/subchannel_cluster_num)*w(:,index((k-1)*subchannel_cluster_num+1))+...
                     (exp(sqrt(-1)*beta(i))*(l/subchannel_cluster_num)*w(:,index(k*subchannel_cluster_num+1))))))^2;
        end
        best_beta = abs((transpose(w_interpolation(:,1)) * transpose(cir_tx_subc(:,:,(k-1)*subchannel_cluster_num + l)))*...
            (transpose(w_interpolation(:,1)) * transpose(cir_tx_subc(:,:,(k-1)*subchannel_cluster_num + l)))');
        best = 1;
        for i = 2 : beta_num
            temp_beta = abs((transpose(w_interpolation(:,i)) * transpose(cir_tx_subc(:,:,(k-1)*subchannel_cluster_num + l)))*...
                (transpose(w_interpolation(:,i)) * transpose(cir_tx_subc(:,:,(k-1)*subchannel_cluster_num + l)))');
            if temp_beta > best_beta
                best_beta = temp_beta;
                best = i;
            end
        end

        w_opt = w_interpolation(:,best);%((1 - l/subchannel_cluster_num)*w(:,index((k-1)*subchannel_cluster_num+1))+...
            %(exp(sqrt(-1)*beta(best))*(l/subchannel_cluster_num)*w(:,index(k*subchannel_cluster_num+1))))/...
            %(norm(((1 - l/subchannel_cluster_num)*w(:,index((k-1)*subchannel_cluster_num+1))+...
            %(exp(sqrt(-1)*beta(best))*(l/subchannel_cluster_num)*w(:,index(k*subchannel_cluster_num+1))))))^2;
        ww(:,(k-1)*subchannel_cluster_num + l) = w_opt;
    end
end
sim_consts.beamformingvec = ww;
index = [1:64];
feedback_bits = inf;        






2018无需申请注册送58体验金