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


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

Re: import data problem

From Bill Rowe <readnews@sbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: import data problem
Date 2011-11-29 12:08 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jb2i0j$5gu$1@smc.vnet.net> (permalink)

Show all headers | View raw


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.

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web