matlab

How to convolve a function with delta function in Matlab?


as we know that another function convolve with delta function, the output will same as the function itself, for example

f(n) * δ(n) = f(n)

For example

n=-10:10;
h=[n>=0];
i=[(n-4)>=0];
f=h-i;

I get the function f(n), but how should I code the δ(n) in order to get a stem plot of f(n) * δ(n) ?

One more question, if we convolve one function itself repeatedly, what actually is happening? I try doing some chain convolution in Matlab like conv(conv(f,f,'same'),f,'same');, the stem plot are varying but i cant figure out the reason. Please assist, thank you.


Solution

  • In discrete math the impulse is δ(0) = 1, δ(n) = 0 for n != 0.

    If you convolve a function with itself, you just do exactly that. There is nothing special about it.

    Convolve it with the mirrored(at the y-axis) function of itself would be an auto-correlation.