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

convolutionmatlab 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?

Best Answer

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.