MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Data Extraction from List {{x1,y1}..{xn,yn}}where ##<x<##


  • To: mathgroup@smc.vnet.net
  • Subject: [mg11714] Re: Data Extraction from List {{x1,y1}..{xn,yn}}where ##<x<##
  • From: Allan Hayes <hay@haystack.demon.co.uk>
  • Date: Thu, 26 Mar 1998 03:08:42 -0500
  • References: <6f1p6l$ffn@smc.vnet.net>

charles wrote:
> 
> Hello,
> 
> How might I extract a range of {x,y}from a list of data, so that I can
> perform a linear fit between the point that meet the criterion of being
> bewteen x_n and x_m.
> 
> In other words, fit a line to a part of the data that has #1<x<#2.

Charles:
Is this the sort of thing that you want?


data = {{4,6},{2,0},{3,1},{6,4}};

Select[data,2<#[[1]]<6&]

{{4, 6}, {3, 1}}

Cases[data, {x_,y_}/;2<x<5]

{{4, 6}, {3, 1}}

Sort will be by the x value then by the y value

Sort[%]

{{3, 1}, {4, 6}}


-- 
Allan Hayes
Mathematica Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642




  • Prev by Date: Re: series expansion of polys with real exponents
  • Next by Date: Re: Re: Re: Mathematica frustrations...
  • Prev by thread: RE: Data Extraction from List {{x1,y1}..{xn,yn}}where ##<x<##
  • Next by thread: Re: Data Extraction from List {{x1,y1}..{xn,yn}}where ##<x<##