Thread Subject: need help in waterfall plot

Subject: need help in waterfall plot

From: Clement Lim

Date: 17 Sep, 2009 14:07:19

Message: 1 of 4

Hi All,

I got the following code to plot a waterfall plot of an audio wav file. However the waterfall plot seems to be "cramping up" together.

[filename, pathname] = uigetfile('*.*', 'Pick any file');
[y, fs, nbits] = wavread(filename);
disp('Playing at the original sample rate.');
sound(y, fs);
disp(fs);
subplot(311)
waterfall(y);

I would like my waterfall plot to look something like what is achieved in the below code. Can anyone pls advise? Thanks.

d=load('chirp');
[ff,ff,tt,pxx]=spectrogram(d.y);
subplot(2,1,1);
spectrogram(d.y);
subplot(2,1,2);
arg={ff,tt,10*log10(abs([pxx.'])+eps)};
waterfall(arg{:});
colormap(jet(256));

Subject: need help in waterfall plot

From: Rune Allnor

Date: 17 Sep, 2009 15:12:36

Message: 2 of 4

On 17 Sep, 16:07, "Clement Lim" <clement...@singnet.com.sg> wrote:
> Hi All,
>
> I got the following code to plot a waterfall plot of an audio wav file. However the waterfall plot seems to be "cramping up" together.

> I would like my waterfall plot to look something like what is achieved in the below code.

What about replicating the commands *before* the
waterfall plot? Chances are they might influence
the end result...

Rune

Subject: need help in waterfall plot

From: Clement Lim

Date: 17 Sep, 2009 15:54:02

Message: 3 of 4

Hi, I did not have any other comands before the waterfall plots beside those listed above. Do I need to add in other stuff to achieve the results? pls advise. Tks for your prompt reply.

Subject: need help in waterfall plot

From: arich82

Date: 18 Sep, 2009 00:35:06

Message: 4 of 4

"Clement Lim" <clementlim@singnet.com.sg> wrote in message <h8tm2q$do4$1@fred.mathworks.com>...
> Hi, I did not have any other comands before the waterfall plots beside those listed above. Do I need to add in other stuff to achieve the results? pls advise. Tks for your prompt reply.

I believe Rune was referring to the 'arg' statement and the two calls to 'spectrogram' in the example code, not your code.

Try replacing your last line with something like:

%%%
[ff,ff,tt,pxx]=spectrogram(y, [], [], nfft, Fs);
arg={ff,tt,10*log10(abs([pxx.'])+eps)};
waterfall(arg{:});
%%%

Also, assuming the pxx value returned from spectrogram behaves something like power^2 (you should check in the help doc to see if this is true), the 10log10 in the 'arg' statement is giving you decibels, which is a conversion you probably should consider.

Note that I don't use these functions, so my interpretation/implementation could be completely wrong. When all else fails, read the help/doc.


--

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
code Sprinceana 17 Sep, 2009 14:06:08
wavread Sprinceana 17 Sep, 2009 14:06:08
waterfall plot Sprinceana 17 Sep, 2009 14:05:55
rssFeed for this Thread

Contact us at files@mathworks.com