Shows "vertcat error" in CIC

12 views (last 30 days)
Jay
Jay on 27 May 2025
Answered: Paul on 28 May 2025
I had a vertcat error while using a CIC filter. It seems that's because y is a row vector. Once I changed y to a column vector like y = y', the vertcat error has gone. However, looking at the document (https://www.mathworks.com/help/dsp/ref/dsp.cicinterpolator-system-object.html), it sounds like it can take any vector or matrix but it seems that's not the case and only take a column vector? Someone could help and clarify this?
% Sample Length
L = 2^16; % Sample Length
%% CIC
R = 64;
M = 1;
N = 4;
%% Signal Generation
nn = (0:L-1); % Time Index
y = sin(pi*nn/2);
%% Interpolation
cic = dsp.CICInterpolator(R,M,N);
out = cic(y);
Error using vertcat
Dimensions of arrays being concatenated are not consistent.

Error in dsp.CICInterpolator/stepImpl (line 217)
Z1 = [Z1(n1+1:end); yconv(:, :)];
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Answers (1)

Paul
Paul on 28 May 2025
Hi Jay,
That doc page does say that the filter can can accept either a vector or a matrix. But we have to look at how the data in the input is interpreted.
Sample- and Frame-Based Concepts states that "in the MATLAB environment, System objects always process frames." That page goes on to explain "the block interprets an M-by-1 vector as a single-channel signal containing M samples per frame. Similarly, the block interprets an M-by-N matrix as a multichannel signal with N independent channels and M samples per channel." Even though that statement is given in the context of Simulink blocks, I think it also applies to system objects. So the input of a 1 x 2^16 row vector is interpreted as one sample in time of each of 2^16 independent channels, as opposed to 2^16 time samples of one channel. See also Create Signals for Frame-Based Processing

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!