不使用conv()命令,我想卷积两个信号:
这是我写的代码:
syms n k i
f= @(n) 2.*(0<=n<=9);
h(n)=((8/9)^n).*heaviside(n-3);
L = length(f);
M = length(h(n));
out=L+M-1;
y=zeros(1,out);
for i = 1:L
for k = 1:M
y(i+k-1) = y(i+k-1) + h(k)*f;
end
end
但是,我得到一个错误:
Unable to perform assignment because value of type 'sym' is not convertible to 'double'.
Error in untitled7 (line 13)
y(i+k-1) = y(i+k-1) + h(k)*f;
Caused by:
Error using symengine
Unable to prove '(0.0 <= 0.0) <= 0.0' literally. Use 'isAlways' to test the statement mathematically.
我找不到一个方法来解决它,也不知道如何在年底,因为这一点。你能帮助我在这两个问题吗?
1条答案
按热度按时间t2a7ltrp1#
示例:如何不使用命令
conv
进行卷积