I've written a simple 1D gaussian filter that I'm convolving with some signal data to produce a smooth trace. The only problem is that when I convolve the data I get major drop near the start and end points of my smoothed signal data. When I plot the data it just warps my graph because it's trying to plot signal values that are like 10 at the start and end, when all my other data is like 10,000-13,000.
Anyone know of any ways to circumvent this/ prevent zero padding of the convolution?
Heres my code:
smooth_signal = conv2(signal_full, 1d_gaus,'same');
Where my input signal_full is a 1055x1 double matrix.
1055samples from the center of the output. - Ben Voigtconv2and notconv? What is1d_gaus? seems that this variable effects the results, try to adjust it. And, I think that "zero padding" is not the term, or i didn't get your question. - Adielsamepropety should do it automatically - Adiel'valid' Returns only those parts of the convolution that are computed without the zero-padded edges.- Ben Voigt1d_gausis just the output of a 1D gaussian function, based on an x of -20:20 and a sigma of 5, so a 41x1 double matrix. Basically what I have at the moment is some noisy signal data that needs to be smoothed and plotted against some time data that starts at 0 seconds and ends at 1000s. Just tried the'valid'option of theconvfunction (Adiel is quite right, I don't need to do theconv2function) However this outputs only a 990 x 1 signal matrix, how would I adjust my time data so it matches up with my new 990 element smoothed signal? - user3168953