In Matlab, you can convolve a 1-dimensional signal with a filter using the "conv" function. Here is an example:
main.m242 chars7 lines
In this example, we first generate a random signal x
with 100 elements and a moving average filter f
with a length of 10 elements. We then use the conv
function to convolve x
with f
, and specify the 'same'
parameter to return the central part of the resulting sequence with the same length as the original x
.
The resulting sequence y
contains the convolved signal.
gistlibby LogSnag