Re: Data Plotting Questions
- To: mathgroup at smc.vnet.net
- Subject: [mg25911] Re: Data Plotting Questions
- From: leko at ix.netcom.com (J. Leko)
- Date: Tue, 7 Nov 2000 23:04:58 -0500 (EST)
- References: <8u8diu$7d4@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <8u8diu$7d4 at smc.vnet.net>, bobmarley4u2c at my-deja.com wrote: > If I have a data, and I found the best fit polynomials. Now I want to > graph the polynomial and the data points on the same graph. How would I > do that in Mathematica? > > > Thanks > > > Sent via Deja.com http://www.deja.com/ > Before you buy. Begin by defining the data points: o2relpop = {{0, 0.1}, {1, 0.2}, {2, 0.35}, {3, 0.6}, {4, 1.0}, {5, 1.0}, {6, 0.883}, {7, 0.883}, {8, 0.4}, {9, 0.2}, {10, 0.1}}; Create a plot of the data: actual = ListPlot[o2relpop, PlotJoined -> True, AxesOrigin -> {0, 0}]; Here is one way to create a ploynomial which best fits these points: func = Interpolation[o2relpop]; Obtain a plot of this function as follows: interpolated = Plot[func[x], {x, 0, 10}]; Combine the two plots: Show[actual, interpolated]; QED. J. Leko Please e-mail replies to leko*j at cspar.uah.edu and remove the *