Error using mfsk waveform for multiple target detection
1 view (last 30 days)
Show older comments
Hi I am trying to simulate mfsk waveform for multiple targets and I am getting "Array exceeds maximum array size preference" error. The thing is, before I didnot use to get this error while working with mfsk waveform for 5 targets. There is something wrong in input parameters of mfsk waveform. Can someone tell me what bandwidth, sample rate, frequency offset should be fine?
clear all;
rng(2015);
%[fmcwwaveform,target,tgtmotion,channel,transmitter,receiver,...
% sensormotion,c,fc,lambda,fs,maxbeatfreq] = helperMFSKSystemSetup;
% System parameter
fc = 24e9; % operating frequency
c = 3e8; % propagation speed
lambda = c/fc; % wavelength
tm = 0.001; % sweep time
bw = 240e6; % range resolution
range_res = bw2range(bw,c); % bandwidth
sweep_slope = bw/tm; % sweep slope
range_max = 100;
fr_max = range2beat(range_max,sweep_slope,c);
v_max = 75;
fd_max = speed2dop(2*v_max,lambda);
fb_max = fr_max+fd_max;
fs = max(2*fb_max,bw);
% fmcwwaveform = phased.FMCWWaveform('SweepTime',tm,'SweepBandwidth',bw,...
% 'SampleRate',fs,'SweepDirection','Triangle');
car1_dist = 10;
car1_speed = 10;
car1_rcs = db2pow(min(10*log10(car1_dist)+5,20));
car2_dist = 25;
car2_speed = 20;
car2_rcs = db2pow(min(10*log10(car2_dist)+5,20));
car3_dist = 40;
car3_speed = 30;
car3_rcs = db2pow(min(10*log10(car3_dist)+5,20));
car4_dist = 60;
car4_speed = 40;
car4_rcs = db2pow(min(10*log10(car4_dist)+5,20));
car5_dist = 80;
car5_speed = 50;
car5_rcs = db2pow(min(10*log10(car5_dist)+5,20));
% truck_dist = 85;
% truck_speed = 25;
% truck_rcs = db2pow(min(10*log10(truck_dist)+5,20));
tgtpos = [[car1_dist;0;0],[car2_dist;0;0],[car3_dist;0;0],[car4_dist;0;0],[car5_dist;0;0]];%,[truck_dist;0;0]];
tgtvel = [[car1_speed;0;0],[car2_speed;0;0],[car3_speed;0;0],[car4_speed;0;0],[car5_speed;0;0]];%,[truck_speed;0;0]];
tgtmotion = phased.Platform('InitialPosition',tgtpos,'Velocity',tgtvel);
tgtrcs = [car1_rcs,car2_rcs,car3_rcs,car4_rcs,car5_rcs];%,truck_rcs];
target = phased.RadarTarget('MeanRCS',tgtrcs,'PropagationSpeed',c,...
'OperatingFrequency',fc);
channel = phased.FreeSpace('PropagationSpeed',c,...
'OperatingFrequency',fc,'SampleRate',fs,'TwoWayPropagation',true);
ant_aperture = 6.06e-4; % in square meter
ant_gain = aperture2gain(ant_aperture,lambda); % in dB
tx_ppower = 100*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;
sensormotion = phased.Platform('Velocity',[radar_speed;0;0]);
mfskwaveform = phased.MFSKWaveform(... %bw=240e6;fs=150e6;tm=0.001
'SampleRate',5*fs,...
'SweepBandwidth',bw,...
'StepTime',tm,...
'StepsPerSweep',512,...
'FrequencyOffset',-468750,...
'OutputFormat','Sweeps',...
'NumSweeps',1);
show(mfskwaveform())
%%spectrograph%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
numsamp_step = round(mfskwaveform.SampleRate*mfskwaveform.StepTime);
sig_display = mfskwaveform();
spectrogram(sig_display(1:8192),kaiser(3*numsamp_step,100),...
ceil(2*numsamp_step),linspace(0,4e6,2048),mfskwaveform.SampleRate,...
'yaxis','reassigned','minthreshold',-60)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Nsweep = 1;
%release(channel);
channel.SampleRate = mfskwaveform.SampleRate;
%release(receiver);
receiver.SampleRate = mfskwaveform.SampleRate;
xr = helperFMCWSimulate(Nsweep,mfskwaveform,sensormotion,tgtmotion,...
transmitter,channel,target,receiver);
x_dechirp = reshape(xr(numsamp_step:numsamp_step:end),2,[]).';
fs_dechirp = 1/(2*mfskwaveform.StepTime);
xf_dechirp = fft(x_dechirp);
num_xf_samp = size(xf_dechirp,1);
beatfreq_vec = (0:num_xf_samp-1).'/num_xf_samp*fs_dechirp;
%clf;
subplot(211),plot(beatfreq_vec/1e3,abs(xf_dechirp(:,1)));grid on;
ylabel('Magnitude');
title('Frequency spectrum for sweep 1');
subplot(212),plot(beatfreq_vec/1e3,abs(xf_dechirp(:,2)));grid on;
ylabel('Magnitude');
title('Frequency spectrum for sweep 2');
xlabel('Frequency (kHz)')
cfar = phased.CFARDetector('ProbabilityFalseAlarm',1e-2,...
'NumTrainingCells',8);
peakidx = cfar(abs(xf_dechirp(:,1)),1:num_xf_samp);
Fbeat = beatfreq_vec(peakidx);
phi = angle(xf_dechirp(peakidx,2))-angle(xf_dechirp(peakidx,1));
sweep_slope = mfskwaveform.SweepBandwidth/...
(mfskwaveform.StepsPerSweep*mfskwaveform.StepTime);
temp = ...
[1 sweep_slope;mfskwaveform.StepTime mfskwaveform.FrequencyOffset]\...
[Fbeat phi/(2*pi)].';
r_est = c*temp(2,:)/2
v_est = lambda*temp(1,:)/(-2)
0 Comments
Answers (0)
See Also
Categories
Find more on Detection, Range and Doppler Estimation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!