简体   繁体   English

Matlab中系列的总和

[英]Double sum of a series in Matlab

I would like to run this function in Matlab: 我想在Matlab中运行此功能:

双重和的功能

where z is a [N1xN2] matrix, x is a [M1xM2] matrix and y is a [P1xP2] matrix. 其中z是[N1xN2]矩阵,x是[M1xM2]矩阵,y是[P1xP2]矩阵。

N1=M1+P1-1 and N2=M2+P2-1 N1 = M1 + P1-1和N2 = M2 + P2-1

I am now trying to do it using 4 for-loops which might be quite time consuming for large matrices. 我现在尝试使用4个for循环来完成此操作,这对于大型矩阵而言可能会非常耗时。

I found symsum() function in Matlab but I cannot see how to adjust it to work for double sums. 我在Matlab中找到了symsum()函数,但看不到如何对其进行调整以适用于双和。 Is there an easier way to do it? 有更简单的方法吗?

The formula which you are trying to calculate is 2D discrete convolution. 您尝试计算的公式是2D离散卷积。

In Matlab, there is a function which calculates it automatically, it is called conv2. 在Matlab中,有一个自动计算它的函数,称为conv2。

Use the following code: 使用以下代码:

Z = conv2(x,y);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM