MATLAB中的3D卷积

时间:2019-07-15 17:06:48

标签: matlab matrix convolution

我目前正在尝试使用卷积来平均数据块,并将当前的336x264x25x27网格转换为新的100x100x27网格。

为了达到这个目的,我一直在尝试使用卷积。

在二维设置中,我已经能够使用matlab中的conv2函数将336x264矩阵转换为100x100。我现在正在尝试使用convn在4-D中完成类似的任务。

如上所述,目前我正在使用convn函数。我试图对前两个维度的单元进行平均,以得到100x100x27的矩阵。我的代码如下:

A = rand(336,264,25,27); % Sample Data
A = A(:,:,13,:); % This line and the following line eliminate the third dimension (time) which will be constant throughout my output. Now "A" is 336x264x27 after using "squeeze".
A = squeeze(A);
B = ones(100,100,27); % This is the size of matrix that I would like to achieve. I was under the impression that "B" was the size matrix that you want to inevitably end up with but I believe I am mistaken.
C = convn(A,B); % C would hopefully by my 100x100x27 matrix.

当前,这导致了435x363x53矩阵。如果您可以帮助我理解我的逻辑,并告诉我如何使用卷积将“ A”转换为100x100x27矩阵,将不胜感激!

0 个答案:

没有答案