?? cpmequ.asv
字號:
clc;
clear all;
close all;
% Set the Global System Parameters
disp('Simulaton process has started!');
cpm_param.M_ary=4;
cpm_param.modulation_efficient_h=1/2;
cpm_param.duration=2;
cpm_param.samples_per_symbol=8;
cpm_param.bits_per_frame=216;
cpm_param.symbols_per_frame=(cpm_param.bits_per_frame)/(log2(cpm_param.M_ary));
cpm_param.samples_per_frame=(cpm_param.samples_per_symbol)*(cpm_param.symbols_per_frame);
cpm_param.initphase=0;
cpm_param.initIk=1;
cpm_param.amptitude=1;
cpm_param.channeltap=5;
cpm_param.pilotnumber=cpm_param.symbols_per_frame;
cpm_param.MSEfilt_N=16;
cpm_param.MSEfilt_length=cpm_param.MSEfilt_N*cpm_param.samples_per_symbol-1;
cpm_param.iteration=2;
% Input Frame Data
load('frame_data_vector.mat');
% CPM Modulation
input_data_vector=frame_data_mapping(cpm_param,frame_data_vector);
cpm_data_vector=cpm_modulator(cpm_param,input_data_vector);
cpm_mod_vector=cpm_data_vector;
% Add ISI
channel_h=h_gen(cpm_param);
chan_s.cosine=conv(cpm_data_vector.cosine,channel_h);
chan_s.sine=conv(cpm_data_vector.sine,channel_h);
start_index=round((cpm_param.channeltap*cpm_param.samples_per_symbol-1)/2);
end_index=size(cpm_data_vector.cosine,1)+start_index-1;
chan_s.cosine=chan_s.cosine(start_index:end_index);
chan_s.sine=chan_s.sine(start_index:end_index);
% Channel Additional Gaussian Noise
cpm_complex_vector=complex(chan_s.cosine,chan_s.sine);
%EbNo=15;
EbNo=1:1:20;
EbNo=EbNo';
number_error_bits=zeros(size(EbNo,1),1);
ber=zeros(size(EbNo,1),1);
for i=1:size(EbNo,1)
fprintf('Eb/No is %ddB!\n',EbNo(i));
SNR=EbNotoSNR(EbNo(i),cpm_param);
for j=1:cpm_param.iteration
cpm_complex=awgn(cpm_complex_vector,SNR,'measured');
cpm_data_vector.cosine=real(cpm_complex);
cpm_data_vector.sine=imag(cpm_complex);
% MSE Linear Equalization
Rchan=zeros(cpm_param.MSEfilt_length);
Rchan1=xcorr(cpm_data_vector.cosine);
for R_i=0:cpm_param.MSEfilt_length-1
for R_j=0:cpm_param.MSEfilt_length-1
Rchan(R_i+1,R_j+1)=Rchan1(cpm_param.pilotnumber*cpm_param.samples_per_symbol+(R_i-R_j));
end
end
Rchan_mod1=xcorr(cpm_mod_vector.cosine,cpm_data_vector.cosine);
start_index=cpm_param.pilotnumber*cpm_param.samples_per_symbol-round((cpm_param.MSEfilt_length-1)/2);
end_index=cpm_param.pilotnumber*cpm_param.samples_per_symbol+round((cpm_param.MSEfilt_length-1)/2);
Rchan_mod=Rchan_mod1(start_index:end_index);
MSEfilt=inv(Rchan)*Rchan_mod;
start_index=round((size(MSEfilt,1)-1)/2);
end_index=start_index+cpm_param.pilotnumber*cpm_param.samples_per_symbol-1;
chan_s_equ.cosine=conv(cpm_data_vector.cosine,MSEfilt);
chan_s_equ.sine=conv(cpm_data_vector.sine,MSEfilt);
chan_s_equ.cosine=chan_s_equ.cosine(start_index:end_index);
chan_s_equ.sine=chan_s_equ.sine(start_index:end_index);
% CPM Demodulation
result_data_vector=cpm_demodulator(cpm_param,chan_s_equ);
% Performance Evaluation
error_bits_vector=frame_data_vector-result_data_vector;
number_error_bits(i)=number_error_bits(i)+sum(error_bits_vector.^2);
end
ber(i)=number_error_bits(i)/(cpm_param.bits_per_frame*cpm_param.iteration);
fprintf('Bit error rate is %d!\n',ber(i));
end
save('cpmequ_linear.mat');
disp('Simulation process has finished!');
disp('Well Done,guy!');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -