convolution without conv function
5 ビュー (過去 30 日間)
古いコメントを表示
I want to convolution of two continuous signals without using conv.
so i code
k= -10 : 0.01 : 10;
t= -10 : 0.01 : 10;
h= @(k,t) (k>=1);
x= @(k,t)(k>=-1).*(k<=1);
y1= int(x(k).*h(-k+t),k,-10,10);
y2= int(h(k).*x(-k+t),k,-10,10);
subplot(4,1,1);plot(k,x(k));
subplot(4,1,2);plot(k,y(k));
subplot(4,1,3);plot(t,y1);
subplot(4,1,4);plot(t,y2);
but there is problem y1 and y2
integral error.
how to integral that?
𝑥(𝑡) = 𝑟𝑒𝑐𝑡 ( 𝑡/ 2 ) , ℎ(𝑡) = 𝑢(𝑡 − 1)
y(t) = integral this x(r)h(t -r )dr (form -10 to 10)
2 件のコメント
Dyuman Joshi
2023 年 4 月 9 日
int is used for symbolic integration.
You have defined "t" and "k" as the independent variables, but you have only used "k" in the definition, so any value of "t" will not have any effect on the outcome.
回答 (3 件)
Paul
2023 年 4 月 9 日
編集済み: Paul
2023 年 4 月 9 日
Questions like this are fairly common on this forum. A closed form expression can be obtained using
Here is a similar Question with answer that may be of interest to adapt to this problem.
0 件のコメント
Matt J
2023 年 4 月 9 日
syms z k t real
h(z)= piecewise(z>=1,1,0);
x(z)= piecewise(abs(z)<=1,1,0);
y1= int(x(k).*h(t-k),k,-10,10)
y2= int(h(k).*x(t-k),k,-10,10)
1 件のコメント
Paul
2023 年 4 月 9 日
Despite the statement in the question, I suspect that the problem is to find the convolution of x(t) and h(t) for -10 <= t <= 10. But that's not the same as integrating over that interval. That interval works fine for y1 because it covers the entire interval where x(t) ~= 0, but not for y2, which is why y1 and y2 are not the same.
I guess more clarity on the question is needed.
Image Analyst
2023 年 4 月 9 日
Attached is a "manual" way to do convolution. It will be straightforward to adapt it from 2-D images to 1-D vectors if you want.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

