-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy patharrangePulseData.m
33 lines (25 loc) · 1016 Bytes
/
arrangePulseData.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function outdata = arrangePulseData(indata,rx,bf,bf_TDD)
% Rearrange a full stream of data into an nSample x nPulse data matrix.
%
% Copyright 2023 The MathWorks, Inc.
% Combine data from channels with calibration weights
indata = applyDigitalCalWeights(indata);
% Extract timing from pluto and phaser setup
fs = rx.SamplingRate;
tsweep = double(bf.FrequencyDeviationTime) / 1e6;
tstartsweep = bf_TDD.Ch0On;
tpulse = bf_TDD.FrameLength / 1e3;
nPulses = bf_TDD.BurstCount;
% Get the number of samples into the pulse that the sweep starts
sweepoffsetsamples = ceil(tstartsweep * fs);
% Get indices within a pulse that contain the sweep data
sweepsamples = 1:ceil(tsweep * fs) + sweepoffsetsamples;
% Get end index of pulse
pulseendsample = round(tpulse * fs);
% Get all of the pulse start indices
pulsestartsamples = (0:nPulses-1)*pulseendsample;
allsweepsamples = repmat(sweepsamples',1,nPulses);
sampleidxs = allsweepsamples + pulsestartsamples;
% Get output data rearranged
outdata = indata(sampleidxs);
end