微信:HuangL1121
QQ号:1224848052
团队:MATLAB/FPGA项目合作——无线基带,人工智能,图像处理以及智能控制等
地址:北京市-朝阳区
当前位置:首页 > 网络算法 > 无线传感网络物理层的主机同步
项目案例
无线传感网络物理层的主机同步
无线传感网络物理层的主机同步
产品说明:

无线传感网络物理层的主机同步

function tstep_PdT
% evluate the performance of master timing synchronization
% 两步积分顺序搜索方法
% 求不同Pd下捕获时长的仿真和理论值曲线

fPd   = [0.50:0.1:0.90,0.95,0.99];   % 前向链路检测概率
fPfa  = 0.1;   % 前项链路虚警概率
rPack = 0.9;   % 反向链路同步确认概率,反向链路确认信息丢失的概率
K     = 10;     % 为防止虚警,重复确认次数,单位:T
D     = 5;      % 反馈时延,单位:T

Ts    = 100;    % 搜索的最大相位差
Ts1   = 10;     % 初步搜索步长
Ts2   = Ts/Ts1; % 初步搜索宽度,要求Ts是Ts1整数倍!
T     = 1;      % 捕获积分宽度,单位:信号周期数

N     = 500;    % 特定相位差条件下求均值的随机次数
ptacq = zeros(1,Ts);
ttacq = zeros(1,N);

Tacq  = zeros(1,length(fPd));       % 仿真获得不同fPd时的平均捕获时长
for pdi=1:length(fPd)
    for i=1:Ts          % 不同初始相位求平均
        rndphase = i-1; % 初始相位差, 设本振相位为0
        for j=1:N       % 指定初始相位条件求平均
            
            rndp1 = floor(rndphase/Ts1);       % 分为两步搜索
            rndp2 = mod(rndphase,Ts1);
            tacq  = 0;                  % 捕获时长,单位:T
            curphase = rndp1;           % 主机当前调整的相位
            while(1)
                if(curphase==0)         % 正好在同步相位位置
                    if(rand()>fPd(pdi) || rand()>rPack)   % 同步漏检 或 同步确认丢失
                        curphase = Ts2-1;
                        tacq = tacq+1;   % 搜索周期计数
                    else
                        tacq = tacq + 1 + K*T + D;  % 同步确认,设同步确认是理想的
                        break;          % 同步捕获完成
                    end;
                else
                    if(rand()<fPfa)     % 出现虚警
                        tacq = tacq + 1+ K*T + D;
                        curphase = curphase -1;
                    else
                        curphase = curphase -1;
                        tacq = tacq+1;  % 搜索周期计数
                    end;
                end;
            end;
            
            % 第二步搜索
            tacq = tacq+D;  % 多引入一次反馈
            curphase = rndp2;
            while(1)
                if(curphase==0)         % 正好在同步相位位置
                    if(rand()>fPd(pdi) || rand()>rPack)   % 同步漏检 或 同步确认丢失
                        curphase = Ts1-1;
                        tacq = tacq+1;   % 搜索周期计数
                    else
                        tacq = tacq + 1 + K*T + D;  % 同步确认,设同步确认是理想的
                        break;          % 同步捕获完成
                    end;
                else
                    if(rand()<fPfa)     % 出现虚警
                        tacq = tacq + 1 + K*T + D;
                        curphase = curphase -1;
                    else
                        curphase = curphase -1;
                        tacq = tacq+1;  % 搜索周期计数
                    end;
                end;
            end;
            
            ttacq(j)=tacq;
        end; % end j cycle
        ptacq(i)=mean(ttacq);
    end; % end i cycle
    Tacq(pdi) = mean(ptacq)
end;
plot(fPd,Tacq,'gx-'); hold on;

% theoritic results
fPd   = [0.50:0.01:0.99];               % 前向链路检测概率
TacqA = zeros(1,length(fPd));           % 理论分析获得不同fPd时的平均捕获时长
q = Ts2+Ts1-1;
for pdi=1:length(fPd)
    TacqA(pdi) = (4+(2-fPd(pdi)*rPack)*(q-1)*(1+(K+D)*fPfa))/2/fPd(pdi)/rPack *T+2*K+3*D;
end;
plot(fPd,TacqA,'k');

-------------------------------------------------------------------------------------------------------------------

联系:Hslogic
QQ :1224848052
微信:HuangL1121
邮箱:1224848052@qq.com
网站:http://www.mat7lab.com/
-------------------------------------------------------------------------------------------------------------------
matlab代做,matlab专业代做,fpga代做,fpga专业代做,simulink代做,simulink专业代做,
matlab coursework代做,matlab assignment代做,matlab留学生代做,fpga毕业设计,
matlab博士代做,matlab 博士SCI代写,matlab 硕士SCI代写,matlab 硕士IEEE代写,matlab 博士IEEE代写,




上一篇:PSO粒子群优化算法*matlab代做|fpga代做

版权所有: MATLAB/FPGA项目合作——无线基带,人工智能,图像处理以及智能控制等 Copyright © 2023 All rights reserved.
微信:HuangL1121 QQ:1224848052
地址:北京市-朝阳区

扫一扫,关注我们