%% Explore Latency of the HDL Channelizer Object
% The latency of the dsp.HDLChannelizer object varies with the FFT length and the vector size. Use the getLatency function to find the latency of a particular configuration. The latency is measured as the number of cycles between the first valid input and the first valid output, assuming that the input is contiguous. The number of filter coefficients does not affect the latency. Setting the output size equal to the input size reduces the latency because the samples are not saved and reordered.
% Create a dsp.HDLChannelizer object and request the latency.

channelize = dsp.HDLChannelizer('NumFrequencyBands',512);
L512 = getLatency(channelize)

%
% Request hypothetical latency information about a similar object with a different number of frequency bands (FFT length). The properties of the original object do not change.

L256 = getLatency(channelize,256)
N = channelize.NumFrequencyBands

%
% Request hypothetical latency information of a similar object that accepts eight-sample vector input.

L256v8 = getLatency(channelize,256,8)

%
% Enable scaling at each stage of the FFT. The latency does not change.

channelize.Normalize = true;
L512n = getLatency(channelize)

%
% Request the same output size and order as the input data. The latency decreases because the object does not need to store and reorder the data before output. The default input size is scalar.

channelize.OutputSize = 'Same as input size';
L512r = getLatency(channelize)

%
% Check the latency of a vector input implementation where the input and output are the same size. Specify the current value of the FFT length and a vector size of 8 samples. The latency decreases because the object computes results in parallel when the input is a vector.

L256rv8 = getLatency(channelize,channelize.NumFrequencyBands,8)

% Copyright 2012 The MathWorks, Inc.