%% Variable-Size Signal Support for Input and Delay Signals
% dsp.VariableFractionalDelay System object supports variable-size input and delay signals. That is, you can change the dimension of the input signal and the delay signal even after calling the algorithm. You can change the dimensions of one or both the signals simultaneously. Together, they must make sure that the number of output channels (number of columns) remains constant.
%
%% Variable-Size Support for Input Signal
% The number of samples in each frame of the input signal can change. However, the number of input channels must remain constant.
% Create a dsp.VariableFractionalDelay object. Pass an input signal of size [256 1] and a delay of 1.4 to the object algorithm. In subsequent calls to the algorithm, change the input frame size to 128, 512, and 64, respectively

vfd = dsp.VariableFractionalDelay;
vfd(randn(256,1),1.4);
vfd(randn(128,1),1.4);
vfd(randn(512,1),1.4);
vfd(randn(64,1),1.4);

% The output frame size (number of rows) changes according to the input frame size. The number of output channels in each of these cases is 1.
% To change the number of input channels, release the object.

release(vfd);

% Call the algorithm with a two-channel input and vary the input frame size in subsequent calls.

vfd(randn(256,2),1.4);
vfd(randn(128,2),1.4);

%
%% Variable-Size Support for Delay Signal
% In addition to the input, the delay signal can also vary. That is, you can change one or both of the dimensions of the delay signal after calling the algorithm. However, the object must make sure that the resulting number of output channels remains constant. The delay signal can be a scalar, vector, matrix, or an N-D array.

release(vfd);
vfd(randn(512,2),randn(512,2));
vfd(randn(128,2),[1.4 1.7]);
vfd(randn(256,2),randn(256,1));
vfd(randn(128,2),1.4);

% In each of these cases, the number of output channels is 2. To apply different delays on the input signal, release the object.

release(vfd);
vfd(randn(256,1),randn(256,7));
vfd(randn(512,1),randn(512,7));
vfd(randn(100,1),randn(100,7));
vfd(randn(100,1),randn(1,7));

% The output in each of these cases is [256 7], [512 7], [100 7], and [100 7], respectively.
% Copyright 2012 The MathWorks, Inc.