[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Newbie question
From: |
Henry F. Mollet |
Subject: |
Re: Newbie question |
Date: |
Thu, 04 Aug 2005 15:57:19 -0700 |
User-agent: |
Microsoft-Entourage/11.1.0.040913 |
I've recently pointed out a similar problem with respect to contourf(z) in
octave-forge. The output is sent to Preview and I don't understand why.
Henry
octave:62> gset term aqua 0
octave:63> [x,y] = meshgrid(linspace(-2,2,200));
octave:64> z = sinc(sqrt(x.^2 + y.^2));
octave:65> contourf(z);
error: expecting integer index, found 7.300000
error: evaluating argument list element number 1
error: called from `contourf' in file
`/usr/local/share/octave/2.1.71/site/m/octave-forge/plot/contourf.m'
octave:65> contourf(z); % works when used for the second time and output
appears in Preview rather than Aquaterm.
## contourf(z,n,w)
## Plots a filled contour plot of n levels using the current
## colormap. The width w is the width of the convolution window
## which smooths the contours.
##
## E.g.,
## [x,y] = meshgrid(linspace(-2,2,200));
## z = sinc(sqrt(x.^2 + y.^2)) + 0.5*randn(size(x));
## contourf(z);
##
## Note that the algorithm computes incorrect contours near the
## edges, which you can see using contourf(sinc(sqrt(x.^2+y.^2)))
## with x,y from above.
## This program is in the public domain
## Author: Paul Kienzle <address@hidden>
function contourf(z,n,w)
if nargin < 3, w = 16; end
if nargin < 2, n = 10; end
if nargin < 1 || nargin > 3
usage("contourf(z [, n [, w]])");
endif
## convolute the original with a gaussian if desired
if w > 0
[x,y] = meshgrid(2.5*linspace(-1,1,w));
B = exp(-.5*(x.^2+y.^2));
z = filter2(B,z,"same");
endif
## find the contours
C = colormap;
colormap(repmat(linspace(0.5,1,n+1)',1,3));
z = filter2(ones(2)/4,imagesc(z));
z(z!=fix(z)) = 0;
## plot the image, with the contours drawn in black.
colormap([0,0,0; C(linspace(1,rows(C),n+1),:)]);
image(flipud(z)+1);
## restore the colormap
colormap(C);
endfunction
on 8/4/05 2:17 PM, Melvyn Poore at address@hidden wrote:
> Hi folks, I¹m new on the block, so forgive me for asking beginner¹s
> questions. I¹ve installed Octave 2.1.71, Gnuplot, Aqua and X11 on my Mac Ti
> Powerbook 550MHz, OSX 10.4.2. It all appears to function as it should.
> That was already quite an achievement!
>
> I¹m working on some sound analysis examples and want to put the waveform and
> spectrogram plots together in a two-plot diagram. This doesn¹t seem to work
> because plot() sends its results out via Aqua whereas the output of
> imagesc() appears in a Mac Preview window. Am I missing some terminal
> setting or something? I¹ve already set the line
>
> __gnuplot_set__ term aqua
>
> in startup/octaverc.
>
> Any help would be appreciated!
>
> Melvyn
-------------------------------------------------------------
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
-------------------------------------------------------------
- Newbie question, Melvyn Poore, 2005/08/04
- Re: Newbie question,
Henry F. Mollet <=