I have a matrix of signals where each row corresponds to a signal and I also have a corresponding matrix of filters where each row is a filter.
Thus, each signal has a filter associated with it. How do I apply the corresponding convolutions at once?

 Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 21 Jun. 2021

0 Stimmen

One way to solve this problem is to convert the filters and signals into cell arrays and make use of 'cellfun' operation to apply row by row convolution.
Assume:
A is the signal matrix where the rows are different signals.
B is the filter matrix with 2 filters
A = [[1 0 1];[1 0 1]];
B = [[2,7];[2,7]];
Convert these matrices into a cell array for faster computation
cellA = num2cell(A, 2)
cellB = num2cell(B,2)
Perform convolution on each row using 'cellfun':
result = cellfun(@(A,B) conv(A, B), cellA,cellb, 'UniformOutput', false);
The last function applies convolution to each row of A with its corresponding filter from B.
'cellfun' applies the desired function (convolution here) to each element of the cell array. More details about 'cellfun' can be found here:

Weitere Antworten (0)

Kategorien

Mehr zu Signal Processing Toolbox finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by