help-octave
[Top][All Lists]
Advanced

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

Re: Looking for waterfall plot function


From: Melvyn Poore
Subject: Re: Looking for waterfall plot function
Date: Wed, 10 Aug 2005 14:14:07 +0200
User-agent: Microsoft-Entourage/10.1.4.030702.0

Well, I¹ve hit a brick wall.  I¹ve included the commented m file here.  I¹d
be very grateful if someone has a few moments to look at it.

Thanks in advance,

Melvyn

function yy=waterfspec(signal, start, steps, N, fS, clippingpoint,
baseplane)
% waterfspec( signal, start, steps, N, fS, clippingpoint, baseplane)
%
% shows short-time spectra of signal, starting
% at k=start, with increments of STEP with N-point FFT
% dynamic range from -baseplane in dB up to 20*log(clippingpoint)
% in dB versus time axis
%
% 18/9/98 J. Schattschneider
% 14/10/2000 U. Zoelner
  echo off;
if nargin<7, baseplane=-100; end
if nargin<6, clippingpoint=0; end
if nargin<5, fS=44100; end
if nargin<4, N=1024; end           % default FFT window length
if nargin<3, steps=round(length(signal)/25); end
if nargin<2, start=0; end

windoo=blackman(N);          % window - default
windoo=windoo*N/sum(windoo); % scaling
% Calculation of number spectra nos
n=length(signal);
rest=n-start-N;
nos=round(rest/steps);
if nos>rest/steps,
 nos=nos-1;
end
% vectors for 3D representation
x = linspace(0, fS/1000, N+1);
z=x-x;
cup=z+clippingpoint;
cdown=z+baseplane;

signal=signal+0.0000001;
% computation of spectra and visual representation
for i=1:1:nos,
 spek1=20.*log10(abs(fft(windoo.*signal(1+start+i*steps:start+N+i*steps)))./
(N)/0.5)\
;
% spek1=abs(fft(windoo.*signal(1+start+i*steps:start+N+i*steps)))./(N)/0.5;
 spek=[-200 ; spek1(1:N)];
 spek=(spek>cup').*cup'+(spek<=cup').*spek;
 spek=(spek<cdown').*cdown'+(spek>=cdown').*spek;
 spek(1)=baseplane-10;
 spek(N/2)=baseplane-10;
 y=x-x+(i-1);
 if i==1
  echo on;
   % here we see size(spek)=1025 1, whereas size(x) & size(y)=1 1025
   size(x)
   size(y)
   size(spek)
  echo off;
  plot3(x(1:N/2), y(1:N/2), spek(1:N/2), "k");
  % set doesn't turn up in help
  %set(p, "Linewidth", 0.1);
 end

 % matlab's patch takes more parameters than octave's patch
 % pp=patch(x(1:N/2), y(1:N/2), spek(1:N/2), "w", "Visible", "on");
 %
 % patch wants spek to be transposed, but it doesn't plot,
 % although AquaTerm appears to be updating on a regular basis.
 % I let it run for half an hour.
 patch(x(1:N/2), y(1:N/2), spek(1:N/2), "w");

 % set(pp, "Linewidth", 0.1);
end
%set(gca, "DrawMode","fast");
axis([-0.3 fS/2000+0.3 0 nos baseplane-10 0]);
%set(gca,"Ydir", "reverse");
view(12,40);


On 09.08.2005 13:30 Uhr, "Shai Ayal" <address@hidden> wrote:

> Melvyn,
> 
> octave's plot function does not return any value, so the variable p is
> undefined. Matlab returns the handles of the lines drawn. Octave does not
> have handle graphics.
> 
> So, try deleting all references to p later on in the file. It might work,
> although produce uglier results.
> 
> Shai
> 
> Melvyn Poore wrote:
>> Does anyone know where I can find a working waterfall plot function?
>> 
>> I found one in the DAFX (ed. Zölzer, Wiley 2002) book, but I can¹t for
>> the life of me get it to work.  It¹s written for MatLab, so I guess
>> there are some differences.
>> 
>> I get the following error:
>> error: value on right hand side of assignment is undefined
>> error: evaluating assignment expression near line 46, column 4
>> 
>> Line 46 is:
>>     p=plot3(x(1:N/2), y(1:N/2), spek(1:N/2), "k");
>> 
>> All the variables are defined and populated, which doesn¹t preclude an
>> undefined value coming out in the wash: but I can¹t see any error in the
>> expression.  I need a hand from someone more experienced, please!
>> 
>> I can post the whole function if necessary.
>> 
>> Cheers,
>> 
>> Melvyn
>>  
>> -- 
>> Melvyn Poore
>> Kantelberg 8
>> 53773 Hennef
>> Germany
>> 
>> Tel: +49 (2248) 446907
>> Mobile: +49 (173) 511 9336
>> email: address@hidden
>> http://www.poore.de
>> http://www.shef.ac.uk/misc/rec/ps/efi/mpoore.html
>> http://www.musikfabriknrw.de





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

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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