⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ppm_th.m

📁 本人编写的一些uwb仿真程序,希望对大家有点用处
💻 M
字号:
%function ppm_th
%ppm_th 跳时脉冲位置调制模拟
%seq    输入序列,已重复编码
%fc     采样频率
%tc     码片时间,即跳时码调制时所乘的时间长度
%ts     重复编码周期
%dppm   ppm调制偏移
%thcode th跳时码
%thseq  仅有th调制时的输出脉冲位置
%ppmthseq ppm+th调制时的输出脉冲位置

function [ppmthseq,thseq]=ppm_th(seq,fc,tc,ts,dppm,thcode)

%step1 implementation of the 2ppm_th modulator

dt=1./fc;   %采样周期
framesamples=floor(ts./dt); %一个脉冲的长度

chipsamples=floor(tc./dt);  %跳时码片的采样点数

ppmsamples=floor(dppm./dt); %ppm偏移的长度

thp=length(thcode);         %跳时码周期

totlength=framesamples*length(seq);  %总采样点数
ppmthseq=zeros(1,totlength);
thseq=zeros(1,totlength);

%step2 main loop for introducing th and 2ppm
%对每一个输入比特计算相应脉冲的位置

for k=1:length(seq)
    
    index=1+(k-1)*framesamples;           %未调制前脉冲所处位置
    
    %引入th调制
    kth=thcode(1+mod(k-1,thp));           %按顺序从跳时码中取出对应的跳时值,在取完后循环至跳时序列的开始
    
    index=index+kth*chipsamples
    
    thseq(index)=1;
    
    %引入2ppm调制
    index=index+ppmsamples*seq(k);
    ppmthseq(index)=1;
    
end

⌨️ 快捷键说明

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