Re: Surface fitting question
- To: mathgroup at smc.vnet.net
- Subject: [mg38496] Re: [mg38472] Surface fitting question
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Fri, 20 Dec 2002 04:25:20 -0500 (EST)
- References: <200212180654.BAA09121@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Your first question is clear enough. Essentially, you want to rename the ticks on the two coordinate axes. I'll give you an example which illustrates the procedure. Suppose this is the array of data you wish to plot: In[1]:= data = Table[Sin[x*y], {x, 0, Pi, Pi/25.}, {y, 0, Pi, Pi/16.}]; In[2]:= gorig=ListPlot3D[data]; Then you obtain a plot with integers ranging from 0 to 16 and 0 to 25 along the axes, respectively. These you want to change into the true values in your problem. Suppose, by way of example, that these true values are given by In[3]:= vals = {Table[j, {j, 0, 3, 3/12.}], Table[j, {j, 0, 250, 250/8.}]} Out[3]= {{0, 0.25, 0.5, 0.75, 1., 1.25, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3.}, {0, 31.25, 62.5, 93.75, 125., 156.25, 187.5, 218.75, 250.}} and that these are the ones you'd like to see along the axes of your plot. The way to do this (or, rather, one way to do this) is to define In[4]:= t1 = Transpose[{Table[j, {j, 0, 24, 2}], vals[[1]]}]; In[5]:= t2 = Transpose[{Table[j, {j, 0, 16, 2}], vals[[2]]}]; and the the following function which will be used as the ticks function, relating the old tick names to the new tick names: In[6]:= tks = {({#[[1]], #[[2]]} & ) /@ t2, ({#[[1]], #[[2]]} & ) /@ t1, None}; Now try In[7]:= Show[gorig, Ticks -> tks]; Here you have your plot with the new tick labels. As for the second question, you certainly need the true x and y values together with data in order to obtain Fit. This is indeed what Fit needs, as you can see in the Help Browser. Tomas Garza Mexico City ----- Original Message ----- From: "Bob Priester" <bpriester at stopthespam.org> To: mathgroup at smc.vnet.net Subject: [mg38496] [mg38472] Surface fitting question > I have data in an ascii text file that consists of 26 rows and 17 > colums of numbers. I would like to fit a surface to the data in order > to get an equation for the contents of the table in terms of the > values that the rows and colums represent. I'm new to mathematica. So > far, this is what I've been able to do (not much): > > data = Table[ReadList["curves.txt", Number, RecordLists -> True]]; > > ListPlot3D[data] > > Then I see a plot of my real data (a surface). It looks correct. But I > can't figure out how to do the following: > > 1. get the real data values on the x & y axes. Ie, the x axis goes > from 0 to 17 and the y axis goes from 0 to 26. What I really need is > the x axis to be from 0.0 to 3.0 (but the steps are not evenly > spaced), and the y axis to go from 0 to 250. At least the z axis (the > surface) is plotting like I need it. > > 2. I think that I'd need the real x and y arrays (not just use the > index) for Fit[] to compute the correct answer. > > > Does anyone have a list of necessary commands to do this? > > thanks, > Bob > > > >
- References:
- Surface fitting question
- From: Bob Priester <bpriester@stopthespam.org>
- Surface fitting question