Convolution of a function g(x) and the dirac delta function.

I want to get the convolution of a function g(x) and the dirac delta function. It should give me the function g(x) back but I'm unable to get it. When I get the stem plot of g(x) and the above convolution, I get different results. What will be the right way to go about doing this?

 採用された回答

John D'Errico
John D'Errico 2018 年 4 月 1 日
編集済み: John D'Errico 2018 年 4 月 1 日

0 投票

Works for me.
G = rand(1,10);
Gconv = conv(G,1);
norm(G-Gconv)
ans =
0
WTP? If you did something different, then you need to show what you did, and ask what is wrong.

3 件のコメント

Satyam Singh
Satyam Singh 2018 年 4 月 1 日
I said convolution WITH dirac delta function. When you take the convolution of dirac delta function with g(x) (which is a vector if x = [-2:0.1:10]) you get some infinities whereas the actual function isn't tending to infinity at any point. So conv(g(x), dirac(x)) doesn't give g(x)
Walter Roberson
Walter Roberson 2018 年 4 月 1 日
[1] is the discrete version of the dirac delta: it is 1 at the center and 0 in the infinite extension to both sides.
John D'Errico
John D'Errico 2018 年 4 月 1 日
編集済み: John D'Errico 2018 年 4 月 1 日
I gave you a convolution with a discrete approximation of a delta function. And I showed that it replicates the original function exactly.
Because conv is a discrete tool, working on discrete vector data, you need to use a unit approximation to the delta function. conv applies to vectors, not functions.
If you were doing a symbolic integration to perform the convolution, then the convolution between the function g(x) and dirac would be correct.
For example, had you tried this:
syms x y
int(sin(x)*dirac(y - x),[-inf,inf])
ans =
sin(y)
Then to no surprise, at least to me, it would work well enough.
You cannot mix the two though. Mixing apples and oranges will just drive you nuts. I prefer cashews. ;-)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by