📄 pcspectrum.m
字号:
function psd=PCspectrum(Signal,Bw,T,Rs)
% function psd=PCspectrum(Bw,T,Rs)
% Pulse Compression Spectrum using FFT
% Parameters:
% Signal -- the signal on time plan
% Bw -- Bandwidth (Hz)
% T -- Pulsewidth (s)
% Rs -- Sample Rates (b/s)
%psd -- Power Spectral Density
% Set Rs to power of 2
if Rs<256
Rs=256;
else Rs=256*(ceil(Rs/256));
end
% Solve Fourier Spectrum of PCs
fsig=fftshift(fft(Signal,2*Rs));
% Solve Power Spectral Density
psd=fsig.*conj(fsig)/Rs;
Amp=max(psd); % Normalize to 1
len=length(fsig);
flabel=(1/T)*(-(len-1)/2:(len-1)/2);
% plot
t=0:1/Bw:T;
maxs=max(Signal);mins=min(Signal);
figure;
subplot(211);
plot(t,Signal(1:length(t)));
% plot(Signal);
axis([0 T mins maxs]);
title('Chirp Waveform');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(212);
plot(flabel,psd/Amp);
grid on;
axis([-Bw Bw 0 1]);
title('Pulse Compression Spectrum');
xlabel('Frequency (Hz)');
ylabel('Amplitude');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -