0

祝大家有美好的一天!

我正在编写一个matlab程序,其中我在Tx的每一列和过滤器h之间进行卷积(我想要逐列过滤:第一列带有过滤器h,第二列带有过滤器h,....和很快)

Tx = complex(randn(165,12), randn(165,12));
h=[0.1 -0.05  0.2  -0.5  0.3 0.02];
  • 我怎样才能继续用过滤器 h 过滤整个 Tx 矩阵?

我的 Matlab 代码:

Tx = complex(randn(165,12), randn(165,12));    
h=[0.1 -0.05  0.2  -0.5  0.3 0.02];
[r c]=size(Tx);

for i=1:c
   Rx=conv(h,Tx(:,i).');
end
  • 我想保存整个结果 Rx 矩阵?
4

1 回答 1

0

Use conv2() with parameter 'same' to preserve the original size or without to get the full convolution.

Example:

conv2(ones(5),[1,2.5,-0.7],'same')
conv2(ones(5),[1,2.5,-0.7]','same')

The first convolvs each row with the filter and the second convolves each column.

You can use

 Rx =conv2(Tx,h','same');
于 2014-07-08T11:23:15.383 回答