Matlab雷达回波数据模拟.docx
- 文档编号:5077247
- 上传时间:2022-12-13
- 格式:DOCX
- 页数:6
- 大小:33.96KB
Matlab雷达回波数据模拟.docx
《Matlab雷达回波数据模拟.docx》由会员分享,可在线阅读,更多相关《Matlab雷达回波数据模拟.docx(6页珍藏版)》请在冰豆网上搜索。
Matlab雷达回波数据模拟
clear,holdoff
formatcompact
J=sqrt(-1);
closeall%Getrootfilenameforsavingresultsfile=input('Enterrootfilenamefordataandlistingfiles:
','s');
%formradarchirppulseT=10e-6; %pulselength,seconds
W=10e6; %chirpbandwidth,Hz
fs=12e6; %chirpsamplingrate,Hz;oversamplebyalittlefprintf('\nPulselength=%gmicroseconds\n',T/1e-6)
fprintf('Chirpbandwidth=%gMhz\n',W/1e6)
fprintf('Samplingrate=%gMsamples/sec\n',fs/1e6)
s=git_chirp(T,W,fs/W);% 120-by-1array
plot((1e6/fs)*(0:
length(s)-1),[real(s)imag(s)])
title('RealandImaginaryPartsofChirpPulse')
xlabel('time(usec)')
ylabel('amplitude')
gridNp=20; %20pulses
jkl=0:
(Np-1); %pulseindexarray,慢时间采样的序列,注意第一个PRI标记为0是为了慢时间起始时刻从零开始
PRF=10.0e3; %PRFinHz
PRI=(1/PRF); %PRIinsec
T_0=PRI*jkl; %relativestarttimesofpulses,insec
g=ones(1,Np); %gainsofpulses
T_out=[1240]*1e-6;%startandendtimesofrangewindowinsec,这个就是接收窗的时间宽度Trec
T_ref=0; %systemreferencetimeinusec,T_ref=0指T_0=0时,r_at_T_0=ri;当T_0~=0时,r_at_T_0=ri-vi*T_0(j)fc=10e9; %RFfrequencyinHz;10GHzisX-bandfprintf('\nWearesimulating%gpulsesatanRFof%gGHz',Np,fc/1e9)
fprintf('\nandaPRFof%gkHz,givingaPRIof%gusec.',PRF/1e3,PRI/1e-6)
fprintf('\nTherangewindowlimitsare%gto%gusec.\n',...
T_out
(1)/1e-6,T_out
(2)/1e-6)%ComputeunambiguousDopplerintervalinm/sec
%Computeunambiguousrangeintervalinmetersvua=3e8*PRF/(2*fc);%第一盲速
rmin=3e8*T_out
(1)/2;
rmax=3e8*T_out
(2)/2;
rua=3e8/2/PRF;fprintf('\nTheunambiguousvelocityintervalis%gm/s.',vua)
fprintf('\nTherangewindowstartsat%gkm.',rmin/1e3)
fprintf('\nTherangewindowendsat%gkm.',rmax/1e3)
fprintf('\nTheunambiguousrangeintervalis%gkm.\n\n',rua/1e3)%Definenumberoftargets,thenrange,SNR,and
%radialvelocityofeach. TheSNRwillbetheactualSNRofthetargetin
%thefinaldata;itwillnotbealteredbyrelativerange.Ntargets=4;
del_R=(3e8/2)*(1/fs)/1e3; %inkm
ranges=[23.84.44.4]*1e3; %inkm
SNR= [-35107]; %dB
vels=[-0.4-0.20.20.4]*vua; %inm/sec%FromSNR,wecomputerelativeRCSusingtheideathatSNRisproportional
%toRCS/R^4. StudentswillbeaskedtodeducerelativeRCS.
rel_RCS=(10.^(SNR/10)).*(ranges.^4);
rel_RCS=db(rel_RCS/max(rel_RCS),'power')
fprintf('\nThereare%gtargetswiththefollowingparameters:
',Ntargets)
fori=1:
Ntargets
fprintf('\n range=%5.2gkm,SNR=%7.3gdB,rel_RCS=%7.3gdB,vel=%9.4gm/s',...
ranges(i)/1e3,SNR(i),rel_RCS(i),vels(i))
end%Nowformtherangebin-pulsenumberdatamapdisp('')
disp('')
disp('...formingsignalcomponent')
y=radar(s,fs,T_0,g,T_out,T_ref,fc,ranges,SNR,vels);%y是337-by-20的矩阵%addthermalnoisewithunitpowerdisp('...addingnoise')
%randn('seed',77348911);
[My,Ny]=size(y);
nzz=(1/sqrt
(2))*(randn(My,Ny)+J*randn(My,Ny));%产生方差为1的复高斯白噪声
y=y+nzz;% createlog-normal(ground)"clutter"withspecifiedC/N and 具体原理不清楚,需要时套用此格式即可!
%log-normalstandarddeviationforamplitude,uniformphase
%Clutterisuncorrelatedinrange,fullycorrelatedinpulse#disp('...creatingclutter')
CN=20; %clutter-to-noiseratioinfirstbin(dB)
SDxdB=3; %indB(thisisNOTthesigmaofthecompleteclutter)
ncc=10.^((SDxdB*randn(My,Ny))/10);
ncc=ncc.*exp(J*2*pi*rand(My,Ny));%ForcethepowerspectrumshapetobeGaussiandisp('...correlatingandaddingclutter')
G =exp(-(0:
4)'.^2/1.0);
G=[G;zeros(Ny-2*length(G)+1,1);G(length(G):
-1:
2)];fori=1:
My
ncc(i,:
)=ifft(G'.*fft(ncc(i,:
)));
end
%rescalecluttertohavedesiredC/Nratio
pcc=var(ncc(:
));
ncc=sqrt((10^(CN/10))/pcc)*ncc;
%10*log10(var(ncc(:
))/var(nzz(:
))) %checkactualC/N%NowweighttheclutterpowerinrangeforassumeR^2(beam-limited)loss
cweight=T_out
(1)*((T_out
(1)+(0:
My-1)'*(1/fs)).^(-1));
cweight=cweight*ones(1,Np);
ncc=ncc.*cweight; %var(ncc)可以看出20列clutter的方差均在30左右y=y+ncc;[My,Ny]=size(y);
d=(3e8/2)*((0:
My-1)*(1/fs)+T_out
(1))/1e3;%T_out
(1))/1e3是接收窗的起始时刻
plot(d,db(y,'voltage'))
xlabel('distance(km)')
ylabel('amplitude(dB)')
grid%Savethedatamatrixinspecifiedfile.
%Savethestudentversioninthemysteryfile.
%Alsosaveallparametervaluedisplaysincorrespondingfiledata_file=[file,'.mat'];
mystery_file=[file,'_mys.mat'];
listing_file=[file,'.lis'];eval(['save',data_file,'JTWfssNpPRFPRIT_outfcvua',...
'rminrmaxruaNtargetsrangesvelsSNRrel_RCSy']);eval(['save-v6',mystery_file,'JTWfssNpPRFT_outfcy']);fid=fopen(listing_file,'w');fprintf(fid,['\rDESCRIPTIONOFDATAINFILE',file,'.matAND',file,'_mys.mat\r\r']);
fprintf(fid,'\rPulselength=%gmicroseconds\r',T/1e-6);
fprintf(fid,'Chirpbandwidth=%gMhz\r',W/1e6);
fprintf(fid,'Samplingrate=%gMsamples/sec\r',fs/1e6);
fprintf(fid,'\rWearesimulating%gpulsesatanRFof%gGHz',Np,fc/1e9);
fprintf(fid,'\randaPRFof%gkHz,givingaPRIof%gusec.',PRF/1e3,PRI/1e-6);
fprintf(fid,'\rTherangewindowlimitsare%gto%gusec.\r',...
T_out
(1)/1e-6,T_out
(2)/1e-6);
fprintf(fid,'\rTheunambiguousvelocityintervalis%gm/s.',vua);
fprintf(fid,'\rTherangewindowstartsat%gkm.',rmin/1e3);
fprintf(fid,'\rTherangewindowendsat%gkm.',rmax/1e3);
fprintf(fid,'\rTheunambiguousrangeintervalis%gkm.\r\r',rua/1e3);
fprintf(fid,'\rThereare%gtargetswiththefollowingparameters:
',...
Ntargets);
fori=1:
Ntargets
fprintf(fid,'\r range=%5.2gkm,SNR=%7.3gdB,rel_RCS=%7.3gdB,vel=%9.4gm/s',...
ranges(i)/1e3,SNR(i),rel_RCS(i),vels(i));
endfclose(fid);fprintf(['\n\nDataisinfile',data_file])
fprintf(['\nStudentdataisinfile',mystery_file])
fprintf(['\nListingisinfile',listing_file,'\n\n']) _________________________________________________________________________用到的函数functiony=radar(x,fs,T_0,g,T_out,T_ref,fc,r,snr,v)
%RADAR simulateradarreturnsfromasinglepulseorburst
% ofidenticalpulses
% usage:
% R=radar(X,Fs,T_0,G,T_out,T_ref,Fc,R,SNR,V)
% X:
basebandsinglepulsewaveform(complexvector)
% Fs:
samplingfrequencyofinputpulse [inHz]
% T_0:
starttime(s)ofinputpulse(s) [sec]
% (numberofpulsesinburstassumed=length(g))
% G:
complexgain(s)ofpulse(s),即慢时间,各个PRI对应的脉冲的前的加权20-by-1
% T_out:
2-vector[T_min,T_max]definesoutput
% windowdelaytimesw.r.t.startofpulse
% T_ref:
system"reference"time,neededtosimulate
% burstreturns.THISISTHE"t=0"TIME!
!
!
% Fc:
centerfreq.oftheradar. [inHz]
% R:
vectorofrangestotarget(s) [meters]
% (numberoftargetsassumed=length(r))
% SNR:
vectoroftargetSNRs(unitnoisepowerassumed)
% ThiswillbeSNR*after*allowingforR^4
% V:
vectoroftargetvelocities(optional) [inm/sec]
% (positivevelocitiesaretowardstheradar)
%
% note
(1):
VELOCITYinmeters/sec!
!
!
% distancesinm,timesinsec,BWinHz.% note
(2):
assumeseachpulseisconstant(complex)amplitude
% note(3):
willaccomodateuptoquadraticphasepulses
% note(4):
vectorofranges,R,allowsDISTRIBUTEDtargets
%
% (c)jMcClellan7/28/90
% ModifiedbyM.A.Richards,August1991J=sqrt(-1);
c=3e8; %velocityoflightinm/sec
Mx=length(x);
delta_t=1/fs; %samplinginterval(sec)
t_y=[T_out
(1):
delta_t:
T_out
(2)]'; %outputsamplingtimes(sec),接收窗的宽度的等间隔采样337-by-1
T_p=Mx*delta_t; %lengthofinputpulse(sec),基带信号chirp的脉冲持续时间,即Te%Assumezerovelocities(stationarytargets)ifnovelocity
%vectorprovidedifnargin<7
v=zeros(r);
end%ensurethatallvectorsarecolumnvectorsx=x(:
); g=g(:
); T_0=T_0(:
); r=r(:
);snr=snr(:
); v=v(:
);%determinethequadraticphasemodulationparametersfor
%laterinterpolationofpulsesamplest_x=delta_t*[0:
(Mx-1)]';
x_ph=unwrap(angle(x));%基带chirp信号的相位,可以看出x_ph是个抛物线
q=polyfit(t_x,x_ph,2);%目的是用q=ax^2+bx+c逼近x_ph%checkresultusingcorrelationcoefficientxfit=polyval(q,t_x);%看看用q=ax^2+bx+c拟合的xfit与x_ph的一致程度
if(x_ph'*xfit)/norm(x_ph)/norm(xfit)<0.99
disp('pulsephaseisnotquadratic')
keyboard
end%
%--- Form(initiallyempty)outputmatrix---
%
Mr=length(t_y); Nr=length(g); %outputsamplesinamatrix
y=zeros(Mr,Nr);%337-by-20%Index'i'loopsoverthenumberoftargets
for i=1:
length(r)
ri=r(i);
vi=v(i);
f_doppler=2*vi*fc/c; %看看目标以速度v接近雷达应该如何表示,f_doppler=2*v/lambda %Index'j'loopsoverthenumberofpulses
forj=1:
length(g)%20 pulses
r_at_T_0=ri-vi*T_0(j);%一般T_0=0表示当下目标离雷达距ri,若T_0 =7则表示7秒前目标离雷达距ri,现在目标距雷达?
%Computestartandendtimeofreflectedpulseatreceiver,
%ensurethatitfallsatleastpartiallywithintherange(time)window
tau=2*r_at_T_0/(c+vi); tmax=tau+T_p;
iftau>=T_out
(2)|tmax<=T_out
(1)
fprintf('\nEchofromtarget#%gatrange%gkm',i,ri)
fprintf('\nisCOMPLETELYOUTOFtherangewindow')
fprintf('\nonpulse#%g.\n',j)
else %Figureoutwhichsamplelocationsintheoutputgridcontain
%reflectedpulse
t_vals=t_y-tau; %t_y是接收窗的区间 tau=2*r_at_T_0/(c+vi),表示tau时刻目标位于r_at_T_0,tau即书上的t0=2R0/c
%用t_vals而不是t_y是为了用t_vals与[0,T_p]这两个上下界相比较,可以想象若用t_y应该和tau和T_p+tau比较
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Matlab 雷达 回波 数据 模拟