[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Plotting problem
From: |
Matthias Brennwald |
Subject: |
Plotting problem |
Date: |
Tue, 2 May 2006 15:25:33 +0200 |
Dear all,
before reading further, a short warning: I'm a newbie (both with
Octave and with this list), so...
I am trying to write some code that plots a "waterfall diagram" (aka.
"cumulative spectral decay diagram", CSD diagram). An example of such
plot is available here: http://www.euronet.nl/users/temagm/audio/
waterfall_focal.htm
I want this code to work both under Matlab and Octave. I use Octave
2.1.72 on the Mac, but the code should not be limited to this
specific setup.
My approach to plotting the waterfall is this (see also example code
below): first, plot the curve in the back as a filled polygon. Then,
plot the next curve also as filled polygon above the one in the back;
and continue in the same way until the frontmost curve. With Matlab,
I can use 'fill3' easily plot these polygons. With plain vanilla
Octave, the only options I have is 'mesh' or '__gnuplot_splot__',
which I cannot make plot FILLED polygons. (I also tried the 'fill3'
command from Octave-forge, but with no luck. Also, I want my code to
be independent of Octave-forge, because Octave-forge is not available
as a 'stable' version from Fink for easy installation on the Mac.)
Any help or ideas?
Matthias
An example illustrating my approach (and problem) is this:
**********************
% First, make up three curves z(x) to play with. Each of the curves
have constant y (y=1,2,3):
x = [0:100];
y = [ 0:2 ];
z = [ 2+sin(x/10);
1.8 + 0.8*sin(x/11);
1.5 + 0.6*sin(x/12); ];
% append some points so we get closed curves:
x = [ x x(end) x(1) x(1) ];
z = [ z [0 0 0]' [0 0 0]' z(:,1) ];
for n=1:3
if exist('OCTAVE_VERSION') % we're running Octave
mesh(x,y(n),z(n,:)); % this plot TRANSPARENT polygons
else % we're running Matlab
poly=fill3(x,repmat(y(n),1,length(z(n,:))),z(n,:),'w'); %
this plots a filled polygon with fill color 'white'
set(poly,'EdgeColor','r'); % this sets the edge of the
polygon to 'red'
end
hold on
end
hold off
**********************
-------
Matthias Brennwald
Lägernstrasse 6
CH 8037 Zürich
+41 (0)44 364 17 03
address@hidden
- Plotting problem,
Matthias Brennwald <=