Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: import data problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123253] Re: import data problem
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Tue, 29 Nov 2011 07:04:51 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

On 11/28/11 at 5:54 AM, hvdosten at gmail.com (Harry) wrote:

>I don't understad what happens with my data...

>
>There are 401 lines of input data). The last lines are:

>...
>19.7999992 -9.13599968 19.8500004 -11.6960001 19.8999996 -11.9519997
>19.9500008 -12.2080002 20. -12.9759998

>Importing these data in Mathematica via

>data = Import["00000.dat", "Table"]

>and everything seems to be ok. But if I try this:

>y = LinearModelFit[data, {x, x^2}, x]

>there is the error message: LinearModelFit::ivar: "{20.05} is not a
>valid variable"

This error indicates you have assigned a value to x
(specifically {20.05}). So, Mathematica evaluates

LinearFit[data, {x, x^2}, x] as

LinearFit[data, {{20.05}, {402.0025}}, {20.05}] which causes the
error. To fix this do one of the following

Clear[x];
y = LinearModelFit[data, {x, x^2}, x]

Block[{x},y = LinearModelFit[data, {x, x^2}, x]]

or start over with a fresh session.




  • Prev by Date: Re: bug
  • Next by Date: Re: Problem with Patterns and Integrate
  • Previous by thread: Re: import data problem
  • Next by thread: Plotting being aborted with RegionBoundary