• 大小: 4KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-05-12
  • 语言: Matlab
  • 标签: AGC  

资源简介

AGC的MATLAB仿真代码,适用fsk和ask的短波

资源截图

代码片段和文件信息

clear all; 
close all;
clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   变量定义、赋值
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SNR=102;                                      %定义信噪比,单位DB
fc=10e6;                                     %最小载频  最大*2
h = 0.6;                                     %调制指数
fz=1000;                                     %衰落频率
fs=50e6;                                     %采样频率
Rb=1e6;                                      %码元速率
Nu=1000;                                      %码元个数
Nn=500;                                      %RMS取值个数 
Vre=1.5;                                     %比较标准值
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
N=fs/fc;                                     %采样点数  
Tc=1/fc;                                     %载波周期
Tb=1/Rb;                                     %码元周期
ts = 1/fs;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   载波调制
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x = randsrc(1Nu[1-1]);                    %信息生成
phase0 = 0;                                  %载波相位,在相干解调情况下可设为0
add_phase = [];                              %附加相位
phase1 = 0;
time = ts:ts:Tb;                             %一个码元周期内采样点数
for i = 1:length(x)
    q = time/(2*Tb);
    if i ~= 1
        theta_k = pi*h*sum(x(1:i - 1));
    else
        theta_k = 0;
    end
    phase1 = theta_k + 2*pi*h*x(i)*q;
    add_phase = [add_phasephase1];
end
cpfsk_num = 0:ts:(length(add_phase) - 1)*ts; %cpfsk的点数
yca = cos(2*pi*fc*cpfsk_num + add_phase + phase0);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  加衰落加噪声
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% ynoise=awgn(sqrt(2)*ycaSNR‘measured‘);       %加

评论

共有 条评论

相关资源