clear;
clc;
close all;
%% Parameters
f0=125e6; % IF signal frequency
Tp=50e-6; % Time duration
B=20e6; % Bandwidth
K=B/Tp; % Chirp slope
fs=100e6; % Sampling frequency
f_nco=25e6; % NCO Frequency
N=5120; % Sampling points
t=0:1/fs:N/fs;
f=(0:N-1)/N*fs;
%% Input signal
s=rectpuls(t-Tp/2,Tp).*exp(1i*2*pi*f0*(t-Tp/2)+1i*pi*K*(t-Tp/2).^2);
s_fft=fft(s,N);
figure(1);
subplot(121);plot(t,real(s)); % Time domain
xlabel('t/s');title('Input Sampled Signal');
subplot(122);plot(f/1e6,abs(s_fft)); % Spectrum of the input sampled signal
xlabel('f/MHz');ylabel('Amplitude'); title('Spectrum'); % Frequency domain
%% NCO signal
x_i=2*cos(2*pi*f_nco*t);
x_q=2*cos(2*pi*f_nco*t-pi/2);
x_ifft=fft(x_i,N);
x_qfft=fft(x_q,N);
figure(2);
subplot(221);plot(t,x_i);
xlabel('t/s');title('In-Phase NCO Signal');
subplot(222);plot(f(1:N/2)/1e6,abs(x_ifft(1:N/2)));
xlabel('f/MHz');ylabel('Amplitude'); title('In-Phase Signal Spectrum');
subplot(223);plot(t,x_q);
xlabel('t/s');title('Quadrature NCO Signal');
subplot(224);plot(f(1:N/2)/1e6,abs(x_qfft(1:N/2)));
xlabel('f/MHz');ylabel('Amplitude'); title('Quadrature Signal Spectrum');
%% Design a 32-th low-pass filter, whose stop frequency is 20 MHz
b=fir1(32,0.4);
[H,w]=freqz(b,1,N);
figure(3);
subplot(121);
plot(f(1:N/2)/1e6,db(abs(H(1:N/2))));
xlabel('f/MHz');ylabel('Magnitude/dB');title('Amplitude Response');
subplot(122);
plot(f(1:N/2)/1e6,angle(H(1:N/2)));
xlabel('f/MHz');ylabel('Magnitude/degrees');title('Phase Response');
%% Down-conversion
s_i=s.*x_i;
s_q=s.*x_q;
si=filter(b,1,s_i);
si_fft=fft(si,N);
sq=filter(b,1,s_q);
sq_fft=fft(sq,N);
figure(4);
subplot(221);plot(t,real(si));
xlabel('t/s');title('Baseband In-Phase Signal');
subplot(222);plot(f(1:N/2)/10^6,abs(si_fft(1:N/2)));
xlabel('f/MHz');ylabel('Amplitude'); title('In-Phase Signal Spectrum');
subplot(223);plot(t,real(sq));
xlabel('t/s');title('Baseband Quadrature Signal');
subplot(224);plot(f(1:N/2)/10^6,abs(sq_fft(1:N/2)));
xlabel('f/MHz');ylabel('Amplitude'); title('Quadrature Signal Spectrum');
figure(5);
base=si-1i*sq;
base_fft=fft(base,N);
subplot(121);plot(t,real(base));
xlabel('t/s');title('Baseband Signal');
subplot(122);plot(f(1:N/2)/10^6,abs(base_fft(1:N/2)));
xlabel('f/MHz');ylabel('Amplitude'); title('Spectrum')
DDC.rar_NCO_SINE_chirp_ddc_数字下变频
版权申诉
5星 · 超过95%的资源 126 浏览量
2022-09-23
04:55:11
上传
评论
收藏 2KB RAR 举报
alvarocfc
- 粉丝: 105
- 资源: 1万+
最新资源
- onenet_chongwukanhu_v06.apk
- 2022NOC软件创意编程赛项真题C++初中-决赛(有解析)
- 2022NOC软件创意编程赛项真题python初中-决赛(有解析)
- openLayer-本地数据加载 (day5)
- A题-正弦信号发生器.xdf
- 2022NOC软件创意编程赛项真题python小学高年级-决赛(有解析)
- mathml转换latex需要的xsl文件
- 2022NOC软件创意编程赛项真题图形化小学高年级-决赛(有解析)
- gbase驱动下载gbase-connector-java-8.3.81.53驱动下载
- 2022NOC软件创意编程赛项真题图形化小学低年级-决赛(有解析)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈