Plot RangeAngleResponse of ACC Example
3 views (last 30 days)
Show older comments
I'm dealing with the ACC example.
Code below is almost similar to original code from ACC example.
clear;close all;clc;
fc = 77e9;
c = physconst('LightSpeed');
lambda = c/fc;
range_max = 80;
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);
fb_max = fr_max; %+fdoppler
fs = max(2*fb_max,bw);
waveform = phased.FMCWWaveform('SweepTime',tm,'SweepBandwidth',bw,'SampleRate',fs);
sig = waveform();
% figure(1);
% subplot(211); plot(0:1/fs:tm-1/fs,real(sig));
% xlabel('Time (s)'); ylabel('Amplitude (v)');
% title('FMCW signal'); axis tight;
% subplot(212); spectrogram(sig,32,16,32,fs,'yaxis');
% title('FMCW signal spectrogram');
%% Target Setting
car_dist = 20;
car_speed = 0;%96*1000/3600;
car_rcs = db2pow(min(10*log10(car_dist)+5,20));
cartarget = phased.RadarTarget('MeanRCS',car_rcs,'PropagationSpeed',c,...
'OperatingFrequency',fc);
carmotion = phased.Platform('InitialPosition',[car_dist;0;0],...
'Velocity',[car_speed;0;0]);
channel = phased.FreeSpace('PropagationSpeed',c,...
'OperatingFrequency',fc,'SampleRate',fs,'TwoWayPropagation',true); %The propagation model is assumed to be free space.
%% Radar System Setup
ant_aperture = 6.06e-4; % in square meter
ant_gain = aperture2gain(ant_aperture,lambda); % in dB
tx_ppower = db2pow(5)*1e-3; % in watts
tx_gain = 9+ant_gain; % in dB
rx_gain = 15+ant_gain; % in dB
rx_nf = 4.5; % in dB
transmitter = phased.Transmitter('PeakPower',tx_ppower,'Gain',tx_gain);
receiver = phased.ReceiverPreamp('Gain',rx_gain,'NoiseFigure',rx_nf,'SampleRate',fs);
radar_speed = 0;
radarmotion = phased.Platform('InitialPosition',[0;0;0],'Velocity',[radar_speed;0;0]);
%% Radar Signal Simulation
% specanalyzer = dsp.SpectrumAnalyzer('SampleRate',fs,...
% 'PlotAsTwoSidedSpectrum',true,...
% 'Title','Spectrum for received and dechirped signal',...
% 'ShowLegend',true);
rng(2012);
Nsweep = 64;
xr = complex(zeros(waveform.SampleRate*waveform.SweepTime,Nsweep));
for m = 1:Nsweep
% Update radar and target positions
[radar_pos,radar_vel] = radarmotion(waveform.SweepTime);
[tgt_pos,tgt_vel] = carmotion(waveform.SweepTime);
% Transmit FMCW waveform
sig = waveform();
txsig = transmitter(sig);
% Propagate the signal and reflect off the target
txsig = channel(txsig,radar_pos,tgt_pos,radar_vel,tgt_vel);
txsig = cartarget(txsig);
% Dechirp the received radar return
txsig = receiver(txsig);
dechirpsig = dechirp(txsig,sig);
% Visualize the spectrum
% specanalyzer([txsig dechirpsig]);
xr(:,m) = dechirpsig;
m
end
rngdopresp = phased.RangeDopplerResponse('PropagationSpeed',c,...
'DopplerOutput','Speed','OperatingFrequency',fc,'SampleRate',fs,...
'RangeMethod','FFT','SweepSlope',sweep_slope,...
'RangeFFTLengthSource','Property','RangeFFTLength',2048,...
'DopplerFFTLengthSource','Property','DopplerFFTLength',256);
clf;
plotResponse(rngdopresp,xr); % Plot range Doppler map
axis([-100 100 0 range_max])
clim = caxis;
What I want to do now is plotting RangeAngleResponse of the example, so I added code at the end.
sULA = phased.ULA('NumElements',4,'ElementSpacing',lambda/2);
rngangresp = phased.RangeAngleResponse('SensorArray',sULA,...
'RangeMethod','FFT','SweepSlope',sweep_slope,'OperatingFrequency',fc,...
'SampleRate',fs,'PropagationSpeed',c,...
'RangeFFTLengthSource','Property','RangeFFTLength',2048);
plotResponse(rngangresp,xr); % Plot range angle map
axis([-100 100 0 range_max])
But I got a lot of errors.
Can you tell me what's going on?
Thanks!
2 Comments
Answers (1)
Honglei Chen
on 11 Dec 2018
It looks like you are using the first part of your code to generate xr and then the second part to do range-angle processing? If that's the case, it won't work because the simulated xr assumes a single element so the spatial domain infromatin is not there and the dimension of the signal is incorrect. You will have to update your signal simulation part to use your ULA too then you can process the signal in the angular domain.
HTH
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!