[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnuplot and/or image[sc] questions

From: Paul Kienzle
Subject: Re: gnuplot and/or image[sc] questions
Date: Fri, 11 May 2001 04:11:11 +0100
User-agent: Mutt/1.2.5i

On Thu, May 10, 2001 at 12:38:22PM -0600, Josh Rigler wrote:
> I am attempting to plot a spectrogram.
> My first question is how do I change my color map to a reasonable RGB
> palette, rather than the 64 element grayscale default?  I've tried a
> couple of different things, but I'm doing something wrong.  I would like
> a palette that runs from about blue (weak signal) to red (strong
> signal).

   R = linspace(0,1,64)';
   G = zeros(64,1);
   B = linspace(1,0,64)';

> My second question is related.  I would like my frequency scale to be
> log 10.

The usual approach to generating a log-frequency scaled spectrogram is
to use a filter bank with narrow low frequency filters and wide high
frequency filters.  There is software for generating 1/3 octave filters
on the mathworks ftp site, or you could try the author's site at:
It's been a while since I looked at it, and I don't remember to what
extent it works under octave.

>  I don't think there is a reasonable way to do this with the
> image[sc] routines.

If you have interp2 from the Octave.sourceforge CVS tree, you could do:

   [S,f,t] = specgram(x,n,Fs);
   logf = logspace(log10(min(f)),log10(max(f)),n);
   logS = interp2(f,t,abs(S),logf,t,'linear');

However, this would not be very stable unless you first averaged the
bins with a frequency dependent averaging window.  But then you've 
just simulated a filterbank, so you might as well do the filterbank
to begin with.

Paul Kienzle

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]