写两段MATLAB代码 第一段绘制不包含频率偏差的主振放大式雷达发射机单频脉冲频谱图(要求:横坐标为频率,纵坐标为功率),第二段绘制相同条件下包含频率偏差的主振放大式雷达发射机单频脉冲频谱图(要求:横坐标为频率,纵坐标为功率)
时间: 2023-11-27 08:49:54 浏览: 75
第一段MATLAB代码:
```
% 主振放大式雷达发射机单频脉冲频谱图(不包含频率偏差)
fs = 100e6; % 采样率
T = 1e-6; % 脉宽
f0 = 5e6; % 载频频率
N = 1024; % FFT点数
t = linspace(0, T, T*fs); % 时间轴
s = sin(2*pi*f0*t); % 单频信号
S = fft(s, N); % FFT
P = abs(S).^2/N; % 功率谱密度
f = (0:N-1)/N*fs; % 频率轴
plot(f, 10*log10(P)); % 绘图
xlabel('Frequency (Hz)');
ylabel('Power (dB)');
title('Spectrum (No Frequency Offset)');
```
第二段MATLAB代码:
```
% 主振放大式雷达发射机单频脉冲频谱图(包含频率偏差)
fs = 100e6; % 采样率
T = 1e-6; % 脉宽
f0 = 5e6; % 载频频率
f_d = 100e3; % 频率偏差
N = 1024; % FFT点数
t = linspace(0, T, T*fs); % 时间轴
s = sin(2*pi*(f0+f_d)*t); % 单频信号
S = fft(s, N); % FFT
P = abs(S).^2/N; % 功率谱密度
f = (0:N-1)/N*fs; % 频率轴
plot(f, 10*log10(P)); % 绘图
xlabel('Frequency (Hz)');
ylabel('Power (dB)');
title('Spectrum (With Frequency Offset)');
```
注意,频率偏差 `f_d` 的值可以根据实际情况进行调整。
阅读全文
相关推荐


















