An incorrect radar range estimation
조회 수: 24 (최근 30일)
이전 댓글 표시
i have used matlab example design "Increasing Angular Resolution with Virtual Arrays" and commented few lines /places of existing code and modified as per my system requirement and attached the matlab code for your reference.
%%%%%%%%%%%%%%%%% START of complete matlab code%%%%%%%%%%%%%%%
clc;
close all;
clear all;
%%%%%%%%%%%%%%%% TDM MIMO MATLAB EXAMPLE %%%%%%%%%
% the two-way pattern of a conventional phased array radar. The two-way pattern of a phased array radar is the product of its transmit array pattern and receive array pattern. For example,
% consider a 77 GHz millimeter wave radar with a 2-element transmit array and a 4-element receive array.
fc = 77e9;
c = 3e8;
lambda = c/fc;
Nt = 2;
Nr = 4;
% % If both arrays have half-wavelength spacing, which are sometimes referred to as full arrays,
% % then the two-way pattern is close to the receive array pattern.
dt = lambda/2;
dr = lambda/2;
txarray = phased.ULA(Nt,dt);
rxarray = phased.ULA(Nr,dr);
ang = -90:90;
pattx = pattern(txarray,fc,ang,0,'Type','powerdb');
patrx = pattern(rxarray,fc,ang,0,'Type','powerdb');
pat2way = pattx+patrx;
helperPlotMultipledBPattern(ang,[pat2way pattx patrx],[-30 0],...
{'Two-way Pattern','Tx Pattern','Rx Pattern'},...
'Patterns of full/full arrays - 2Tx, 4Rx',...
{'-','--','-.'});
% % If the full transmit array is replaced with a thin array, meaning the element spacing is wider than half wavelength, then the two-way pattern has a narrower beamwidth.
% % Notice that even though the thin transmit array has grating lobes, those grating lobes are not present in the two-way pattern.
dt = Nr*lambda/2;
txarray = phased.ULA(Nt,dt);
pattx = pattern(txarray,fc,ang,0,'Type','powerdb');
pat2way = pattx+patrx;
figure
helperPlotMultipledBPattern(ang,[pat2way pattx patrx],[-30 0],...
{'Two-way Pattern','Tx Pattern','Rx Pattern'},...
'Patterns of full/full arrays - 2Tx, 4Rx',...
{'-','--','-.'});
varray = phased.ULA(Nt*Nr,dr);
patv = pattern(varray,fc,ang,0,'Type','powerdb');
figure
helperPlotMultipledBPattern(ang,[pat2way patv],[-30 0],...
{'Two-way Pattern','Virtual Array Pattern'},...
'Patterns of thin/full arrays and virtual array',...
{'-','--'},[1 2]);
%%%%%% TDM-MIMO Radar Simulation(existing)%%%%
% range_max = 200;
% tm = 5.5*range2time(range_max,c);
% range_res = 1;
% bw = range2bw(range_res,c);
% sweep_slope = bw/tm;
% fr_max = range2beat(range_max,sweep_slope,c);
%
% v_max = 230*1000/3600;
% fd_max = speed2dop(2*v_max,lambda);
%
% fb_max = fr_max+fd_max;
% fs = max(2*fb_max,bw);
%%%%Modified 1%%%%%%
range_max = 6;
tm = 36*10^-6;
range_res = 5*10^-2;
bw = range2bw(range_res,c);
sweep_slope = bw/tm;
fr_max = range2beat(range_max,sweep_slope,c);
v_max = 26*1000/3600;
fd_max = speed2dop(2*v_max,lambda);
fb_max = fr_max+fd_max;
fs = max(2*fb_max,bw);
fs =6*10^6;
%%%%%%%%%%%%%%%%%%%%%
waveform = phased.FMCWWaveform('SweepTime',tm,'SweepBandwidth',bw,...
'SampleRate',fs);
fs = waveform.SampleRate;
transmitter = phased.Transmitter('PeakPower',0.001,'Gain',36);
receiver = phased.ReceiverPreamp('Gain',40,'NoiseFigure',4.5,'SampleRate',fs);
txradiator = phased.Radiator('Sensor',txarray,'OperatingFrequency',fc,...
'PropagationSpeed',c,'WeightsInputPort',true);
rxcollector = phased.Collector('Sensor',rxarray,'OperatingFrequency',fc,...
'PropagationSpeed',c);
%%%%existing%%%%%%
% radar_speed = 100*1000/3600; % Ego vehicle speed 100 km/h
% radarmotion = phased.Platform('InitialPosition',[0;0;0.5],'Velocity',[radar_speed;0;0]);
%
% car_dist = [40 50]; % Distance between sensor and cars (meters)
% car_speed = [-80 96]*1000/3600; % km/h -> m/s
% car_az = [-10 10];
% car_rcs = [20 40];
% car_pos = [car_dist.*cosd(car_az);car_dist.*sind(car_az);0.5 0.5];
%%%%Modified 2%%%%%%
radar_speed = 0*1000/3600; % Ego vehicle speed 100 km/h
radarmotion = phased.Platform('InitialPosition',[0;0;0.5],'Velocity',[radar_speed;0;0]);
car_dist = [2 5]; % Distance between sensor and cars (meters)
car_speed = [0 0]*1000/3600; % km/h -> m/s
car_az = [-20 20];
car_rcs = [1 1];
car_pos = [car_dist.*cosd(car_az);car_dist.*sind(car_az);0.5 0.5];
cars = phased.RadarTarget('MeanRCS',car_rcs,'PropagationSpeed',c,'OperatingFrequency',fc);
carmotion = phased.Platform('InitialPosition',car_pos,'Velocity',[car_speed;0 0;0 0]);
channel = phased.FreeSpace('PropagationSpeed',c,...
'OperatingFrequency',fc,'SampleRate',fs,'TwoWayPropagation',true);
rng(2017);
%%% existing%%%%%%
%Nsweep = 64;
%Dn =2; % Decimation factor
%%% Modified 3%%%%%%
Nsweep = 128;%%% Modified
Dn = 1; % Decimation factor
fs = fs/Dn;
xr = complex(zeros(fs*waveform.SweepTime,Nr,Nsweep));
w0 = [0;1]; % weights to enable/disable radiating elements
for m = 1:Nsweep
% Update radar and target positions
[radar_pos,radar_vel] = radarmotion(waveform.SweepTime);
[tgt_pos,tgt_vel] = carmotion(waveform.SweepTime);
[~,tgt_ang] = rangeangle(tgt_pos,radar_pos);
% Transmit FMCW waveform
sig = waveform();
txsig = transmitter(sig);
% Toggle transmit element
w0 = 1-w0;
txsig = txradiator(txsig,tgt_ang,w0);
% Propagate the signal and reflect off the target
txsig = channel(txsig,radar_pos,tgt_pos,radar_vel,tgt_vel);
txsig = cars(txsig);
% Dechirp the received radar return
rxsig = rxcollector(txsig,tgt_ang);
rxsig = receiver(rxsig);
dechirpsig = dechirp(rxsig,sig);
% Decimate the return to reduce computation requirements
for n = size(xr,2):-1:1
xr(:,n,m) = decimate(dechirpsig(:,n),Dn,'FIR');
end
end
xr1 = xr(:,:,1:2:end);
xr2 = xr(:,:,2:2:end);
xrv = cat(2,xr1,xr2);
nfft_r = 2^nextpow2(size(xrv,1));
nfft_d = 2^nextpow2(size(xrv,3));
figure
rngdop = phased.RangeDopplerResponse('PropagationSpeed',c,...
'DopplerOutput','Speed','OperatingFrequency',fc,'SampleRate',fs,...
'RangeMethod','FFT','PRFSource','Property',...
'RangeWindow','Hann','PRF',1/(Nt*waveform.SweepTime),...
'SweepSlope',waveform.SweepBandwidth/waveform.SweepTime,...
'RangeFFTLengthSource','Property','RangeFFTLength',nfft_r,...
'DopplerFFTLengthSource','Property','DopplerFFTLength',nfft_d,...
'DopplerWindow','Hann');
[resp,r,sp] = rngdop(xrv);
plotResponse(rngdop,squeeze(xrv(:,1,:)));
respmap = squeeze(mag2db(abs(resp(:,1,:))));
ridx = helperRDDetection(respmap,-10);
xv = squeeze(sum(resp(ridx,:,:),1))';
doa = phased.BeamscanEstimator('SensorArray',varray,'PropagationSpeed',c,...
'OperatingFrequency',fc,'DOAOutputPort',true,'NumSignals',2,'ScanAngles',ang);
[Pdoav,target_az_est] = doa(xv);
fprintf('target_az_est = [%s]\n',num2str(target_az_est));
doarx = phased.BeamscanEstimator('SensorArray',rxarray,'PropagationSpeed',c,...
'OperatingFrequency',fc,'DOAOutputPort',true,'ScanAngles',ang);
Pdoarx = doarx(xr);
figure
helperPlotMultipledBPattern(ang,mag2db(abs([Pdoav Pdoarx])),[-30 0],...
{'Virtual Array','Physical Array'},...
'Spatial spectrum for virtual array and physical array',{'-','--'});
%%%%%%%%%%%% %%%%Added %%%%%% range Plot %%%%%%%%%%%%%%%%%%5
Range_Nfft= 2^nextpow2(size(xrv,1));
fRng_axis = (fs/Range_Nfft) *(-Range_Nfft/2 : (Range_Nfft/2)-1) ;
Rng_axis = fRng_axis * (tm*c)/(bw*2);
Xrng=fftshift( fft(sum(xrv,3),Range_Nfft) ,1);
figure
plot(Rng_axis,abs(Xrng(:,1)));
xlabel('Range in m')
ylabel('level')
title('range plot');
%%%%%%%%%%%%%%%%% End of complete matlab code%%%%%%%%%%%%%%%
i have mentioned places of changes for your reference:
1. system calcualtions are modified as per my requirement (long range to very short range) as shown below:
%%%%%% TDM-MIMO Radar Simulation(existing)%%%%
% range_max = 200;
% tm = 5.5*range2time(range_max,c);
% range_res = 1;
% bw = range2bw(range_res,c);
% sweep_slope = bw/tm;
% fr_max = range2beat(range_max,sweep_slope,c);
%
% v_max = 230*1000/3600;
% fd_max = speed2dop(2*v_max,lambda);
%
% fb_max = fr_max+fd_max;
% fs = max(2*fb_max,bw);
%%%%Modified 1%%%%%%
range_max = 6;
tm = 36*10^-6;
range_res = 5*10^-2;
bw = range2bw(range_res,c);
sweep_slope = bw/tm;
fr_max = range2beat(range_max,sweep_slope,c);
v_max = 26*1000/3600;
fd_max = speed2dop(2*v_max,lambda);
fb_max = fr_max+fd_max;
fs = max(2*fb_max,bw);
fs =6*10^6;
%%%%%%%%%%%%%%%%%%%%%
2. target parameters are modified as per my requirement (long range to very short range) as shown below:
%%%%existing%%%%%%
% radar_speed = 100*1000/3600; % Ego vehicle speed 100 km/h
% radarmotion = phased.Platform('InitialPosition',[0;0;0.5],'Velocity',[radar_speed;0;0]);
%
% car_dist = [40 50]; % Distance between sensor and cars (meters)
% car_speed = [-80 96]*1000/3600; % km/h -> m/s
% car_az = [-10 10];
% car_rcs = [20 40];
% car_pos = [car_dist.*cosd(car_az);car_dist.*sind(car_az);0.5 0.5];
%%%%Modified 2%%%%%%
radar_speed = 0*1000/3600; % Ego vehicle speed 100 km/h
radarmotion = phased.Platform('InitialPosition',[0;0;0.5],'Velocity',[radar_speed;0;0]);
car_dist = [2 5]; % Distance between sensor and cars (meters)
car_speed = [0 0]*1000/3600; % km/h -> m/s
car_az = [-20 20];
car_rcs = [1 1];
car_pos = [car_dist.*cosd(car_az);car_dist.*sind(car_az);0.5 0.5];
3. Number of sweeps are modified as per my requirement
%%% existing%%%%%%
%Nsweep = 64;
%Dn =2; % Decimation factor
%%% Modified 3%%%%%%
Nsweep = 128;%%% Modified
Dn = 1; % Decimation factor
4.Added range estimation and plotting on the existing code
%%%%%%%%%%%% %%%%Added %%%%%% range Plot %%%%%%%%%%%%%%%%%%5
Range_Nfft= 2^nextpow2(size(xrv,1));
fRng_axis = (fs/Range_Nfft) *(-Range_Nfft/2 : (Range_Nfft/2)-1) ;
Rng_axis = fRng_axis * (tm*c)/(bw*2);
Xrng=fftshift( fft(sum(xrv,3),Range_Nfft) ,1);
figure
plot(Rng_axis,abs(Xrng(:,1)));
xlabel('Range in m')
ylabel('level')
title('range plot');
My question:
1. its observed Range estimations are incorrect from therotical range of targets =[ 2 5 ] metre,please refer below range-doppler plot and range plot.
2.kindly check the code and confirm ,is there any mistake or any logics are need to be added?
댓글 수: 0
답변 (1개)
Greg
2024년 11월 11일 19:01
Thank you for your question. The issue is hard coding the sampling rate value. Based on the radar parameters, the hard coded sampling rate is set to a value which is much smaller than the sampling rate required. By commenting out "fs = 6*10^6", it allows fs to be set correctly by waveform.SampleRate after the phased.FMCWWaveform object is created. This ensures the sample rate is consistent with the waveform's configuration. After commenting out "fs" you will see the targets at the correct range (You'll have to zoom in to the new image to see the targets at the correct range).
참고 항목
카테고리
Help Center 및 File Exchange에서 Detection에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!