47 lines
1.8 KiB
Matlab
47 lines
1.8 KiB
Matlab
clear all;
|
||
close all;
|
||
clc;
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%% 时域数字正交相干检波 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||
%%********** 线性调频信号 ***********%%
|
||
T=10e-3; %信号时宽
|
||
B=30e4; %信号带宽
|
||
fs=4*B; %采样频率
|
||
f0=3/4*fs; %载频频率
|
||
N=fix(T*fs); %采样点数
|
||
|
||
t=(-N/2:N/2-1)/fs;
|
||
sr=cos(2*pi*f0*t+pi*(B/T).*t.^2); %sr是以fs=4B的采样频率采样后的数字信号
|
||
|
||
figure; plot(t*1e6,sr);
|
||
title('线性调频信号波形');
|
||
xlabel('t/us');
|
||
ylabel('sr');
|
||
%%********** 1.混频 **********%%
|
||
x_I=sr.*cos(2*pi*f0*t);
|
||
x_Q=-sr.*sin(2*pi*f0*t);
|
||
%%********** 2.低通滤波 **********%%
|
||
%使用Parks McClellan算法设计FIR滤波器:Fs=4B,截止频率为B/2,过渡带宽度为B/10.
|
||
fl=200;
|
||
fbe=[0 (B/2)/(fs/2) (B/2+B/10)/(fs/2) 1];
|
||
Damps=[1 1 0 0];
|
||
b=firpm(fl,fbe,Damps);
|
||
figure;
|
||
freqz(b);
|
||
title('FIR滤波器的幅频和相频特性');
|
||
%使用由分子和分母系数 b 和 a=1 定义的有理传递函数对输入数据 x 进行滤波。
|
||
x_I_filter=filter(b,1, x_I );
|
||
figure;subplot(2,1,1); plot(t*1e6,x_I_filter);xlabel('t/us');ylabel('x_I_ filter');title('低通滤波后的I路信号');
|
||
x_Q_filter=filter(b,1, x_Q );
|
||
subplot(2,1,2); plot(t*1e6,x_Q_filter);xlabel('t/us');ylabel('x_Q_ filter');title('低通滤波后的Q路信号');
|
||
%%********** 3.抽样 **********%%
|
||
x_I_ex=x_I_filter(1:2:end);
|
||
figure; subplot(2,1,1);plot(t(1:2:end)*1e6,x_I_ex);xlabel('t/us');ylabel('x_I_ ex');title('抽样后的I路信号');
|
||
x_Q_ex=x_Q_filter(1:2:end);
|
||
subplot(2,1,2); plot(t(1:2:end)*1e6,x_Q_ex);xlabel('t/us');ylabel('x_Q_ ex');title('抽样后的Q路信号');
|
||
%%************ 4.合成 ***********%%
|
||
x_ex= x_I_ex+1j*x_Q_ex;
|
||
figure;
|
||
plot(t(1:2:end)*1e6,x_ex);
|
||
xlabel('t/us');
|
||
ylabel('x_ ex');title('正交下变频的最终合成信号');
|