对 MATLAB 卷积实现的理解感到困惑?

发布于 2025-01-14 18:58:14 字数 598 浏览 2 评论 0原文

我正在尝试在 MATLAB 中实现卷积而不使用内置命令。我已经从谷歌获得了一段代码以及一些如何理解它的代码,但仍然存在一些困惑,特别是关于突出显示的行,更具体地说是关于红色圆圈术语,我知道我们正在使用嵌套 for 循环来限制积分,但我无法了解红色圆圈项背后的逻辑,该项与我们的卷积公式有何关系。如果我删除这个术语,我的结果不再有效此外

,在典型的卷积理论公式中,我们看到输入与移位脉冲相乘或移位输入与脉冲相乘,但在这里它们在没有任何明显移位的情况下相乘

我的代码如下:

clear
x=[1 2]
h=[3 4 5]
N = length(x);
M = length(h);   
length_out=N+M-1;
y=zeros(1,length_out); 
for i = 1:N
    for k = 1:M
      y(i+k-1) = y(i+k-1) + h(k)*x(i);
    end
end

在此处输入图像描述

I am trying to implement convolution in MATLAB without using built in command. I have obtained a code from google and some how understood it but still there is some confusion especially regarding the highlighted line and more specifically about the red encircled term, i know that we are using nested for loops for limits of integral but i am unable to understand the logic behind the red encircled term, how is this term relating to our formula of convolution. If i remove this term,my results are not valid any more

Also in typical theory formula of convolution we see input is multiplied with shifted impulse or shifted input is mulltiplied with impulse but here they are being multiplied without any apparent shift

My code is below:

clear
x=[1 2]
h=[3 4 5]
N = length(x);
M = length(h);   
length_out=N+M-1;
y=zeros(1,length_out); 
for i = 1:N
    for k = 1:M
      y(i+k-1) = y(i+k-1) + h(k)*x(i);
    end
end

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文