Error: Conversion to logical from sym is not possible.
2 ビュー (過去 30 日間)
古いコメントを表示
Why I get the error in title?
syms x h myconv
myconv=0;
h=0;
x(n)=(1/2^(-n+1))*(heaviside(n+2)-heaviside(n-2));
if (0<n)&&(n<7)
for i=-1000:1:n
h=h+(sin(2*i)+(-1)^i)*(heaviside(i+3)-heaviside(i-5));
end
else
h=0;
end
for i=-1000:1:1000
myconv=x(i)*h(n-i)+myconv;
end
N=-5:1:5;
figure
subplot(2,2,1);
stem(N, subs(x,n,N), 'bo');
title('x(n)')
subplot(2,2,2);
stem(N, subs(h,n,N), 'ro');
title('h(n)')
subplot(2,2,3);
stem(N, subs(myconv,n,N), 'ko');
title('convolution')
5 件のコメント
Walter Roberson
2018 年 3 月 19 日
You do not change your code to fix this. Your entire premise is broken. You are not going to be able to find the infinite limit of the convolution of arbitrary functions using the techniques you are using. You would need to apply analytical reasoning to figure out the zone in which the function is not zero, do the calculation within that zone, and then the infinite limit is the same since going out further will just be zeros outside that range.
Walter Roberson
2018 年 3 月 19 日
"Error using : (line 38) Cannot compute the number of steps from -1000 to n by 1."
It is not permitted to have a symbolic variable as a bound for a for loop.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Subplots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!