%%demo of chirp signal
T=10e-6; %pulse duration10us
B=30e6; %chirp frequency modulation bandwidth 30MHz
K=B/T; %chirp slope
Fs=2*B;Ts=1/Fs; %sampling frequency and sample spacing
N=T/Ts;
t=linspace(-T/2,T/2,N);
subplot(211)
plot(t*1e6,St);
xlabel('Time in u sec');
title('线性调频信号');
grid on;axis tight;
subplot(212)
freq=linspace(-Fs/2,Fs/2,N);
plot(freq*1e-6,fftshift(abs(fft(St))));
xlabel('Frequency in MHz');
title('线性调频信号的幅频特性');
grid on;axis tight;
%%demo of chirp signal after matched filter
T=10e-6; %pulse duration10us
B=30e6; %chirp frequency modulation bandwidth 30MHz
K=B/T; %chirp slope
Fs=10*B;Ts=1/Fs; %sampling frequency and sample spacing
N=T/Ts;
t=linspace(-T/2,T/2,N);
St=exp(j*pi*K*t.^2); %chirp signal
Ht=exp(-j*pi*K*t.^2); %matched filter
subplot(211)
L=2*N-1;
t1=linspace(-T,T,L);
Z=abs(Sot);Z=Z/max(Z); %normalize
Z=20*log10(Z+1e-6);
Z1=abs(sinc(B.*t1)); %sinc function
Z1=20*log10(Z1+1e-6);
t1=t1*B;
plot(t1,Z,t1,Z1,'r.');
axis([-15,15,-50,inf]);grid on;
legend('emulational','sinc');
xlabel('Time in sec \times\itB');
ylabel('幅度,dB');
title('傅里叶变换后的线性调频信号');
subplot(212) %zoom
N0=3*Fs/B;
t2=-N0*Ts:Ts:N0*Ts;
t2=B*t2;
plot(t2,Z(N-N0:N+N0),t2,Z1(N-N0:N+N0),'r.');
axis([-inf,inf,-50,inf]);grid on;
set(gca,'Ytick',[-13.4,-4,0],'Xtick',[-3,-2,-1,-0.5,0,0.5,1,2,3]);
xlabel('Time in sec \times\itB');
ylabel('幅度,dB');
title('傅里叶变换后的线性调频信号(Zoom)');
加白噪声后的线性调频信号
T=10e-6; %pulse duration10us
B=30e6; %chirp frequency modulation bandwidth 30MHz
K=B/T; %chirp slope
Fs=2*B;Ts=1/Fs; %sampling frequency and sample spacing
N=T/Ts;
t=linspace(0,T,N);
St=exp(j*pi*K*t.^2);
subplot(211)
plot(t*1e6,St);
xlabel('Time in u sec');
title('线性调频信号');
grid on;axis tight;
SNR=input('please enter the number you guess: ');
x=awgn(St, 5); %generate chirp signal
subplot(212)
plot(t*1e6,x);
xlabel('Time ');
title('加噪后的线性调频信号');
grid on;axis tight;
%%脉冲压缩
% input('\nPulse radar compression processing: \n ');
clear;
close all;
T=10e-6;
B=30e6;
Rmin=8500;Rmax=11500;
R=[9000,10000,10200];
RCS=[1 1 1 ];
C=3e8;
K=B/T;
Rwid=Rmax-Rmin;
Twid=2*Rwid/C;
Fs=5*B;Ts=1/Fs;
Nwid=ceil(Twid/Ts);
t=linspace(2*Rmin/C,2*Rmax/C,Nwid);
M=length(R);
td=ones(M,1)*t-2*R'/C*ones(1,Nwid);
SNR=[1,0.1,0.01,0.001,10,100,1000];
for i=1:1:7
Srt1=RCS*(exp(1i*pi*K*td.^2).*(abs(td)<T/2));
n=sqrt(0.5*SNR(i))*(randn(size(Srt1))+1i*randn(size(Srt1)));
Srt=Srt1+n;
%Digtal processing of pulse compression radar using FFT and IFFT
Nchirp=ceil(T/Ts);
Nfft=2^nextpow2(Nwid+Nwid-1);
Srw=fft(Srt,Nfft);
Srw1=fft(Srt1,Nfft);
t0=linspace(-T/2,T/2,Nchirp);
St=exp(1i*pi*K*t0.^2);
Sw=fft(St,Nfft);
% d=2*pi/(Ts*Nfft);k=floor(-(Nfft-1)/2:(Nfft-1)/2);
% plot(k*d,abs(Sw)) ;
Sot=fftshift(ifft(Srw.*conj(Sw)));
Sot1=fftshift(ifft(Srw1.*conj(Sw)));
N0=Nfft/2-Nchirp/2;
Z=abs(Sot(N0:N0+Nwid-1));
% Z=20*log10(Z+1e-6);
figure
% figure('position',[0 0 1024 700]);
subplot(211)
plot(t*1e6,real(Srt));
axis tight;
xlabel('us');ylabel('幅度')
title(['加噪线性调频信号压缩前,SNR =',num2str(-1*10*log10(SNR(i)))]);
subplot(212)
plot(t*C/2,Z)
% axis([8500,11500,-60,0]);
xlabel('Range in meters');ylabel('幅度 ')
% title(['Radar echo after compression with noise,the SNR =',-1*10*log10(SNR(i))]);
title(['加噪线性调频信号压缩后,SNR =',num2str(-1*10*log10(SNR(i)))]);
% Z1=abs(Sot1(N0:N0+Nwid-1));
% Z1=Z1/max(Z1);
% Z1=20*log10(Z1+1e-6);
% figure('position',[0 0 1024 700]);
% subplot(211)
% plot(t*1e6,real(Srt1));axis tight;
% xlabel('Time in u sec');ylabel('Amplitude')
% title('Radar echo without compression without noise');
%
% subplot(212)
% plot(t*C/2,Z1)
% axis([10000,15000,-60,0]);
% xlabel('Range in meters');ylabel('Amplitude in dB')
% title('Radar echo after compression without noise');
%
end
评论0