MATLAB Answers


Spectrogram Image Filtering, Colorbar

Asked by B
on 27 Mar 2013

This is a weird question but here goes. I have created a spectrogram using MATLAB's built in function. Basically I want to be able to filter the spectrogram to change the intensity levels. I also need this change to be reflected in the colorbar. For example, if I save the spectrogram as a jpeg and filter that image, the entire image is filtered including the axes, titles, and the colorbar. I want to be able to just filter the spectrogram and have the changes in the intensity be reflected in the colorbar. Any ideas? Should I save the figure as something else? Hopefully that makes sense.


What do you mean filter? Give an example.

I mean like a spatial filter such as the built-in average filter: fspecial('average'). I am basically trying to reduce noise by reducing the intensity of the spectrogram. I know this is very unconventional but I wanted to see if it was possible.


No products are associated with this question.

1 Answer

Answer by Image Analyst
on 27 Mar 2013
 Accepted answer

The color bar is a mapping of intensity to color. If you change the intensity, though noise reduction or filtering or any other method, then in the image it will take on the new color for that new intensity that it has. This will happen automatically (or as soon as you display the new intensity image with imshow() or imagesc()).

Use export_fig() to save. Find it in the File Exchange on the front page.


I think that's my problem. I don't know how to save the image without the whole axes. The axes are included in the output of "spectrogram". How do I just save the image without axes?

I don't know how you generated the image. What code did you use? What toolbox does it require?

Here is my code that creates the data and the spectrogram. It only uses the signal processing toolbox.


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!