help-octave
[Top][All Lists]
Advanced

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

Re: partial plot


From: Miquel Cabanas
Subject: Re: partial plot
Date: Thu, 18 Mar 2004 17:02:08 +0100
User-agent: Mutt/1.3.28i

hi,

try using find() and isnan() to select valid items in the
y-vector and map that selection to the x-vector. Note that
find is not always required. For instance,

octave:1> y = [10, -20, NaN, -40, 50, NaN, 70, -80];
octave:2> !isnan(y)
ans =

  1  1  0  1  1  0  1  1

octave:3> y(!isnan(y))
ans =

   10  -20  -40   50   70  -80

octave:4> x = 1:1:length(y)
x =

  1  2  3  4  5  6  7  8

octave:5> x(!isnan(y))
ans =

  1  2  4  5  7  8

octave:6> plot( x(!isnan(y), y(!isnan(y) )


Miquel



On Thu, Mar 18, 2004 at 07:52:56AM -0600, Pascal A. Dupuis wrote:
> After some computation I obtain a matrix of values I wish to plot. But
> some of the values are not reliable, and I can define a logical matrix
> (matrix of ones and zeros) telling if the corresponding result is
> valid or not.
> 
> I would like to have a plot containing only the valid values. 
> I tried:
>   - plot(value(Is_valid)) -> this does not work as the result is a
>   column vector
>   - Is_nvalid = Is_valid == 0; value(Is_nvalid)=NA -> but this does
>   not work either, as NA values are strangely intepolated.
> 
> What I would like is that values flagged as invalid are not plotted,
> yet the x-abscissa is incremented by one unit. For instance, 
> plot([-2 NA -1]) should join the pair (1, -2) and (3, -1) instead of
> (1, -2) and (2, -1). Is there some way to achieve this other than
> plotting the matrix rows by rows ?
> 

-- 
Miquel E Cabanas ------------------------------------------------------
SeRMN, Universitat Autonoma de Barcelona (address@hidden)
------------------------------------------o-oo--ooo---ooo--oo-o--------



-------------------------------------------------------------
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]