Octave - 卷积代码问题[关闭]

问题描述 投票:0回答:0

我需要解决问题。

Octave中的代码是什么?

我有两个卷积函数。

  1. x[n] = 5n ; h[n] = d[n + 2]

  2. x[n] = cos(4πn+2) ; ℎ[𝑛] = ∑ 0,4𝛿(𝑡 − 𝑘)

对于第一个功能:

x[n] = 5n ; h[n] = d[n + 2]

代码可以吗?

n = 0:10;
x = 5 * n; 
h = [zeros(1,2) 1 zeros(1,length(n)-2)];

y = conv(x,h);

stem(n,y(1:length(n)));
xlabel('n');
ylabel('y[n]');

对于第二个功能:

x[n] = cos(4πn+2) ; ℎ[𝑛] = ∑ 0,4𝛿(𝑡 − 𝑘)

代码可以吗?

n = 0:99;
x = cos(4*pi*n+2);
h = zeros(1,length(n));

for k = 0:4
  h(k+1) = 1;
end

y = conv(x,h);

stem(n,y(1:length(n)));
xlabel('n');
ylabel('y[n]');

非常感谢您的帮助。

谢谢!

octave convolution
© www.soinside.com 2019 - 2024. All rights reserved.