Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6807 > unrolled thread

Re: import data problem

Started byBill Rowe <readnews@sbcglobal.net>
First post2011-11-29 12:08 +0000
Last post2011-11-29 12:08 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: import data problem Bill Rowe <readnews@sbcglobal.net> - 2011-11-29 12:08 +0000

#6807 — Re: import data problem

FromBill Rowe <readnews@sbcglobal.net>
Date2011-11-29 12:08 +0000
SubjectRe: import data problem
Message-ID<jb2i0j$5gu$1@smc.vnet.net>
On 11/28/11 at 5:54 AM, hvdosten@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.

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web