📄 main.m
字号:
clc
prompt={'mod_mode(2,4,16,64)','the number of rand number'};
dlg_title = 'Please set the following Simulation Parameters';
num_lines=1;
def={'64','6000000'};
answer=inputdlg(prompt,dlg_title,num_lines,def);
k = 0;
k = k +1;
mod_mode= str2num(answer{k});
k=k+1;
num_rand=str2num(answer{k});
a=randn(1,num_rand);
[j,q]=size(a);
mod_in=zeros(j,q);
for i=1:q
if(a(i)>0)
mod_in(i)=0;
else
mod_in(i)=1;
end
end
[m,n]=size(mod_in);
if mod_mode==4
if rem(n,2)~=0
error('the column number of mod_in must be multiple of 2')
end
end
if mod_mode==16
if rem(n,4)~=0
error('the column number of mod_in must be multiple of 4')
end
end
if mod_mode==64
if rem(n,6)~=0
error('the column number of mod_in must be multiple of 6')
end
end
start_time=cputime;
mod_out=modulation(mod_in,mod_mode);
demod_in=mod_out;
demod_out = demodulation(demod_in,mod_mode);
ber=sum(xor(mod_in,demod_out))/n
runtime=(cputime-start_time)/3600
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -