10.7MHzFM信号的射频直接带通采样用matlab实现
时间: 2024-05-26 17:01:22 浏览: 234
以下是一个简单的matlab代码实现:
% 设置采样频率和信号频率
fs = 20e6; % 采样频率
f = 10.7e6; % 信号频率
% 生成一个10.7MHz的FM信号
t = 0:1/fs:1/f; % 采样时间
x = cos(2*pi*f*t + 100*sin(2*pi*10*t)); % FM信号
% 进行射频直接带通采样
fc = 10.7e6; % 采样中心频率
Ts = 1/fs; % 采样时间间隔
n = 0:length(x)-1; % 采样点序列
y = x .* exp(-1j*2*pi*fc*n*Ts); % 射频直接带通采样
% 绘制采样前后的信号时域波形
figure;
subplot(2,1,1);
plot(t, x);
xlabel('Time (s)');
ylabel('Amplitude');
title('Original FM signal');
subplot(2,1,2);
plot(t, real(y));
xlabel('Time (s)');
ylabel('Amplitude');
title('RF direct sampling signal');
相关问题
10.7MHzFM中频信号的AD带通采样的MATLAB
代码如下:
% 10.7MHz FM intermediate frequency signal sampling
clear all;
close all;
% Sampling parameters
fs = 22.4e6; % Sampling frequency
Ts = 1/fs; % Sampling period
N = 8192; % Number of samples
% Signal parameters
fc = 10.7e6; % Carrier frequency
fm = 20e3; % Modulation frequency
kf = 75e3; % Frequency deviation constant
Ac = 1; % Carrier amplitude
% Generate FM signal
t = linspace(0, N*Ts, N);
s = Ac*cos(2*pi*fc*t + 2*pi*kf*cumsum(sin(2*pi*fm*t))*Ts);
% Plot FM signal
figure;
plot(t, s);
xlabel('Time (s)');
ylabel('Amplitude');
title('FM Signal');
% Calculate frequency spectrum of FM signal
S = fftshift(fft(s));
f = linspace(-fs/2, fs/2, N);
figure;
plot(f, abs(S));
xlabel('Frequency (Hz)');
ylabel('Magnitude');
title('Frequency Spectrum of FM Signal');
% Bandpass filter
f_passband = [9.7e6, 11.7e6];
f_stopband = [9.5e6, 11.9e6];
rp = 0.1; % Passband ripple (dB)
rs = 60; % Stopband attenuation (dB)
[n, Wn] = buttord(f_passband/(fs/2), f_stopband/(fs/2), rp, rs);
[b, a] = butter(n, Wn, 'bandpass');
s_filtered = filter(b, a, s);
% Plot filtered signal
figure;
plot(t, s_filtered);
xlabel('Time (s)');
ylabel('Amplitude');
title('Filtered FM Signal');
% Calculate frequency spectrum of filtered signal
S_filtered = fftshift(fft(s_filtered));
figure;
plot(f, abs(S_filtered));
xlabel('Frequency (Hz)');
ylabel('Magnitude');
title('Frequency Spectrum of Filtered FM Signal');
% Bandpass sampling
fs_bandpass = 200e3; % Bandpass sampling frequency
Ts_bandpass = 1/fs_bandpass; % Bandpass sampling period
t_bandpass = 0:Ts_bandpass:(N-1)*Ts_bandpass; % Bandpass sampling time vector
s_bandpass = s_filtered(1:floor(fs/fs_bandpass):end); % Bandpass sampled signal
% Plot bandpass sampled signal
figure;
plot(t_bandpass, s_bandpass);
xlabel('Time (s)');
ylabel('Amplitude');
title('Bandpass Sampled FM Signal');
% Calculate frequency spectrum of bandpass sampled signal
S_bandpass = fftshift(fft(s_bandpass));
f_bandpass = linspace(-fs_bandpass/2, fs_bandpass/2, length(s_bandpass));
figure;
plot(f_bandpass, abs(S_bandpass));
xlabel('Frequency (Hz)');
ylabel('Magnitude');
title('Frequency Spectrum of Bandpass Sampled FM Signal');
matlab设计10.7MHzFM信号的带通采样
以下是在MATLAB中设计一个10.7MHz FM信号的带通采样的代码:
```matlab
fc = 10.7e6; % 载波频率
fm = 50e3; % 调制频率
Fs = 2*fc; % 采样频率
t = 0:1/Fs:0.1; % 时间向量
kf = 10e3; % 调制指数
% FM信号生成
x = cos(2*pi*fc*t + 2*pi*kf*cumsum(sin(2*pi*fm*t)));
% 带通滤波器设计
Wp = [2*pi*(fc-5e3) 2*pi*(fc+5e3)]/Fs; % 通带截止频率
Ws = [2*pi*(fc-10e3) 2*pi*(fc+10e3)]/Fs; % 阻带截止频率
Rp = 1; % 通带最大衰减
Rs = 40; % 阻带最小衰减
[n, Wn] = buttord(Wp, Ws, Rp, Rs); % 计算巴特沃斯滤波器阶数和截止频率
[b, a] = butter(n, Wn); % 巴特沃斯滤波器系数
% 带通采样
f0 = fc - 5e3; % 带通中心频率
T0 = 1/f0; % 带通周期
Ts = T0/2; % 带通采样间隔
n_samples = length(x); % 采样点数
sampled = zeros(1, n_samples);
for i = 1:n_samples
if mod(t(i)/T0, 1) < Ts/T0
sampled(i) = x(i);
end
end
% 带通滤波
filtered = filter(b, a, sampled);
% 画图
figure;
subplot(3,1,1);
plot(t, x);
title('FM信号');
xlabel('时间 (s)');
ylabel('幅度');
subplot(3,1,2);
plot(t, sampled);
title('带通采样后的信号');
xlabel('时间 (s)');
ylabel('幅度');
subplot(3,1,3);
plot(t, filtered);
title('带通滤波后的信号');
xlabel('时间 (s)');
ylabel('幅度');
```
这个代码首先生成了一个10.7MHz的FM信号,然后设计了一个巴特沃斯带通滤波器,以保留5kHz到15kHz之间的频率成分。接着,使用带通采样方法,对这个信号进行了采样,采样间隔为带通周期的一半。最后,对采样得到的信号进行带通滤波,以恢复原始信号。
运行代码后,会得到一个包含三个子图的图形窗口。第一个子图是原始的10.7MHz FM信号,第二个子图是经过带通采样后的信号,第三个子图是经过带通滤波后的信号。可以看到,带通采样和带通滤波后的信号已经恢复了原始信号的形状和频率成分。
阅读全文