MATLAB DLL 算法稳定 2PSK 信号频率和相位
%% 参数设置 Fs = 50e6; % 采样率 fc = 5e6; % 载波频率 T = 1/Fs; % 采样时间间隔 N = 1000; % 信号长度 Eb = 1; % 符号能量 EbN0 = 10; % 信噪比 alpha = 0; % 相移角度
%% 生成调制信号 data = randi([0,1],1,N); s = sqrt(Eb)exp(1j(2pifc*(0:N-1)T+pi(1-2*data)+alpha));
%% 加入高斯白噪声 SNR = EbN0 + 10log10(log2(2)); sigma = sqrt(1/(210^(SNR/10))); n = sigma*(randn(1,N)+1j*randn(1,N)); r = s + n;
%% DLL信号处理 Kp = 0.5; % 比例增益 Kv = 0.1; % 积分增益 tau = 1e-3; % 积分时间常数 NCO = exp(-1j2pifcT); % 数字控制振荡器 I = real(r); % 信号取实部 Q = imag(r); % 信号取虚部 f0 = 5e6; % 初始频率偏差 theta = 0; % 初始相位偏差 f_hat = zeros(1,N); % 频率估计结果 theta_hat = zeros(1,N); % 相位估计结果 for i = 2:N % 频率估计 f_hat(i) = f_hat(i-1) - KpQ(i)cos(theta_hat(i-1))-Kvf_hat(i-1)TQ(i)sin(theta_hat(i-1)); % 相位估计 theta_hat(i) = theta_hat(i-1) + 2pi(f0+f_hat(i))T + KpI(i)sin(theta_hat(i-1))-KvI(i)f_hat(i)Tcos(theta_hat(i-1)); end dll_out = exp(-1j(2pifc*(0:N-1)*T+theta_hat));
%% 带通滤波器处理 f1 = fc-1e6; % 通带下限 f2 = fc+1e6; % 通带上限 Wn = [f1 f2]/(Fs/2); % 归一化通带截止频率 n_order = 4; % 阶数 [b,a] = butter(n_order,Wn); % 生成滤波器系数 s_filtered = filter(b,a,s); % 滤波后的信号
%% 画图对比 figure; subplot(3,1,1); plot(real(s),'b'); hold on; plot(imag(s),'r'); title('调制信号'); legend('实部','虚部'); subplot(3,1,2); plot(real(dll_out),'b'); hold on; plot(imag(dll_out),'r'); title('DLL输出信号'); legend('实部','虚部'); subplot(3,1,3); plot(real(s_filtered),'b'); hold on; plot(imag(s_filtered),'r'); title('滤波后的信号'); legend('实部','虚部');
原文地址: https://www.cveoy.top/t/topic/n9R0 著作权归作者所有。请勿转载和采集!