cpm_demodulator.m

来自「CPM调制的线性均衡器」· M 代码 · 共 35 行

M
35
字号
function result_data_vector=cpm_demodulator(cpm_param,cpm_data_vector)
%disp('CPM demodulation process has started!');
[lm,lp]=rat(cpm_param.modulation_efficient_h);

if mod(lm,2)==0
    previous_phase_state_number=lp;    
else
    previous_phase_state_number=2*lp;   
end

i=1:previous_phase_state_number;
previous_state.phase=pi*lm*(i'-1)/lp;

i=(-cpm_param.M_ary+1):2:(cpm_param.M_ary-1);
previous_state.Ik=i';

previous_state.phasenumber=previous_phase_state_number;
previous_state.number=previous_phase_state_number*power(cpm_param.M_ary,cpm_param.duration-1);
previous_state.weight=zeros(previous_state.number,1);
previous_state.code=zeros((cpm_param.symbols_per_frame),previous_state.number);

%   Step3, viterbi decoder
for i=1:(cpm_param.symbols_per_frame)
    cpm_data_vector.start_index=(i-1)*(cpm_param.samples_per_symbol)+1;
    cpm_data_vector.end_index=i*(cpm_param.samples_per_symbol);
    previous_state.index=i;
    current_state=viterbi_decoder(cpm_param,cpm_data_vector,previous_state);
    previous_state=current_state;
end
%   Step4, the path with the largest weight is the result
[maxweight,maxindex]=max(current_state.weight);
demodulator_symbols_vector=current_state.code(:, maxindex);
%   get the original frame databits
result_data_vector=frame_data_unmapping(cpm_param,demodulator_symbols_vector);
%disp('CPM demodulation process has finished!');

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?