spectrogram: Can I do a subtraction of the mean value in each window?
5 views (last 30 days)
Show older comments
I want to create a spectrogram (with the function "spectrogram") for high frequencies. But my data contains also very low frequencies. Therefore in the windows that are used for the spectrogram the values do not necessarily oscillate around 0. And that causes artefacts in my spectrogram.
Can I do a subtraction of the mean value in each window? Can I do this with the function spectrogram or do I have to use another function?
Clarification: The data is a 1D signal.
0 Comments
Answers (1)
Image Analyst
on 30 Nov 2012
Is this a 1-D signal or a 2D image? Either way, you can use conv() or conv2() respectively to subtract the mean in a window from the signal. Here's a 1D example:
windowWidth = 15;
middleElement = ceil(windowWidth/2);
kernel = -ones(1, windowWidth) / windowWidth;
kernel(middleElement) = 1 + kernel(middleElement)
filteredSignal = conv(signal, kernel, 'same');
2 Comments
See Also
Categories
Find more on Time-Frequency Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!