[Date Index]
[Thread Index]
[Author Index]
Re: surface fitting question
*To*: mathgroup at smc.vnet.net
*Subject*: [mg61362] Re: surface fitting question
*From*: Ralph Smith <ralph at lkjlkj.com>
*Date*: Mon, 17 Oct 2005 02:29:27 -0400 (EDT)
*References*: <diprth$hpc$1@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
On Sat, 15 Oct 2005 03:09:37 +0000 (UTC), Ralph Smith <ralph at lkjlkj.com> wrote:
>I have this data in a file. It is a 2D table that 26 rows and 17 columns.
>
> |
>-----------------------------------------------------------------------
> | 0.000 0.000 0.000 ... 0.000 0.000 0.000
> | 0.050 0.050 0.155 ... 16.409 19.375 20.156
> | .
> | .
> | .
> | 47.500 50.000 55.000 ... 2017.500 2075.580 2182.765
>-----------------------------------------------------------------------
> |
>
>I would like to find an equation that describes this surface using
>mathematica. I think that 3rd degree polynomials would be what I'm looking
>for. So, maybe
> data[x,y] = ax^3 + bx^2 + cx + d + ey^3 + fy^2 + gy
>
>I've seen and example that uses Fit[], so I think this can be done, but I'm
>a novice at mathematica and don't know how to set this problem up. I have been
>able to fit a polynomial to curve data, but now I need to fit a surface.
>
>thanks,
>Ralph
>
>
I finally understood the syntax and things are starting to work. It waw simple, but I needed to
change my input text file to just the x,y,z points (one point per line)
data1 = Table[ ReadList["c:\\curves1.txt", Number, RecordLists -> True]];
f1 = Fit[data1, { x, y, y^2, y^3}, {x, y}]
Plot3D[f1, {x, 0, 250}, {y, 0, 3}, BoxRatios -> {1, 1, 1}, Axes -> True, AxesLabel -> {"RPM",
"Amps", "Watts"}, ViewPoint -> {1.3, -3, .8}, Lighting -> True]
Next I thought that I'd try ScatterPlot3D to just look at the raw data (unfitted). That was working
yesterday, but after loading the notebook today. I no longer get a plot, just a printout of the
numbers. At the top of the .nb file I have Needs["Graphics`Graphics3D`"]. The output looks like
this:
ScatterPlot3D[{0., 0., 0.}, {0., 0.05, 0.},....ViewPoint -> {1.3, -3, 0.8}, BoxRatios -> {1, 1, 1},
Lighting -> True,
Axes -> True, AxesLabel -> {"RPM", "Amps", "Watts"}]
with no error message. Here's what I'm trying to do.
data0 = ReadList["c:\\curves1.txt", {Number, Number, Number} ];
ScatterPlot3D[data0, ViewPoint -> {1.3, -3, .8}, BoxRatios -> {1, 1, 1},
Lighting -> True, Axes -> True, AxesLabel -> {"RPM", "Amps", "Watts"}]
I read about trying Remove[ScatterPlot3D] and reloading Graphics3D before using ScatterPlot3D, but
I can't get the plot back. What's wrong?
Also, I've never surface fitted before, I got a nice function with Fit[] but it doesn't fit my data
very well at all. I threw out some terms since they were close to 0.
w = 2.552*rpm*rpm - 1025.386*current + 1109.29*current*current - 220.538*current*current*current;
Is there a way to fit this data more exactly with a function? I saw in another other post of this
thread that some functions in the Statistics package may work but I haven't tried that yet. The
scatterplot (when it worked) showed a fairly smooth (and simple) surface. The Fit[] with polynomials
is way off at x=0. All of the z values should be 0 but I'm getting numbers like 100 or so for the
surface along that line.
thanks,
Ralph
Prev by Date:
**Stylesheets vs. DTDs or XML Schemas**
Next by Date:
**Re: Getting a pure text widget?**
Previous by thread:
**Re: surface fitting question**
Next by thread:
**Re: surface fitting question**
| |