Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6807 > unrolled thread
| Started by | Bill Rowe <readnews@sbcglobal.net> |
|---|---|
| First post | 2011-11-29 12:08 +0000 |
| Last post | 2011-11-29 12:08 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: import data problem Bill Rowe <readnews@sbcglobal.net> - 2011-11-29 12:08 +0000
| From | Bill Rowe <readnews@sbcglobal.net> |
|---|---|
| Date | 2011-11-29 12:08 +0000 |
| Subject | Re: 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.
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web