COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Table lookup or curve fitting?

• Email
• Follow

```I would like to write a small program for my HP50 that can compute the
inflated value of an sum of money from yesteryear. Two methods come to
mind:

1. Table lookup. Look up the year and the product from a table.
2. Polynomial fitting. Fit a polynom to my data beforehand, and do a
straight forward calculation at input time.

What method should you use?

If table drivven, what object type? List or matrix?

I have the data in an excel sheet (two columns year and "multiplier"),
ready to import into the HP50, as soon as I have decided on the
correct form.

How do I go forward with this revolutionary program? :-)

Per.

```
 0

See related articles to this posting

```Polynomial fitting if not handled carefully can come up with very
strange results. I would go with the table and may interpolate locally
to find the values between the cells with low order polynomials. There
should be some spline programs on hpcalc.org

Arnaud

```
 0

```perstromgren <stromgren.per@gmail.com> wrote:
>
> 1. Table lookup. Look up the year and the product from a table.
> 2. Polynomial fitting. Fit a polynom to my data beforehand, and do a
> straight forward calculation at input time.

Every real world problem I have worked on that uses emperical data
has always used table lookups (with interpolation).

- Kurt
```
 0

```On 3 Nov, 07:42, ~kurt <actinouran...@earthlink.net> wrote:
> perstromgren <stromgren....@gmail.com> wrote:
>
> > 1. Table lookup. Look up the year and the product from a table.
> > 2. Polynomial fitting. Fit a polynom to my data beforehand, and do a
> > straight forward calculation at input time.
>
> Every real world problem I have worked on that uses emperical data
> has always used table lookups (with interpolation).

What would be your choice of object type for "table" here: list or
matrix? And what may be a good approach to find a value in the list or
matrix, knowing that the data are sorted, but not every value is
present?

I can of course use brute force, but I would rather use something
Knuth wold agree with!

Per.

>
> - Kurt

```
 0

```On Nov 3, 11:08 am, perstromgren <stromgren....@gmail.com> wrote:

> What would be your choice of object type for "table" here: list or
> matrix? And what may be a good approach to find a value in the list or
> matrix, knowing that the data are sorted, but not every value is
> present?
>
> I can of course use brute force, but I would rather use something
> Knuth wold agree with!

I made my own interpolation program using matrices.  I'd be happy to
post it, but you may be wanting to write your own and I wouldn't want
to take away the fun.  It does a binary search to find the correct
pair of values to interpolate between.  I cannot guarantee Knuth would
approve however. :)

I posted a two-way interpolation program here about a year ago.
Search for 'TWINT' if you're interested.  I've tweaked it a little
since.

-wes

```
 0

```On Fri, 02 Nov 2007 05:16:52 -0700, perstromgren <stromgren.per@gmail.com>
wrote:

>I would like to write a small program for my HP50 that can compute the
>inflated value of an sum of money from yesteryear. Two methods come to
>mind:
>
>1. Table lookup. Look up the year and the product from a table.
>2. Polynomial fitting. Fit a polynom to my data beforehand, and do a
>straight forward calculation at input time.
>
>What method should you use?

What's wrong with using the built-in Financial solver?

>
>If table drivven, what object type? List or matrix?
>
>I have the data in an excel sheet (two columns year and "multiplier"),
>ready to import into the HP50, as soon as I have decided on the
>correct form.
>
>How do I go forward with this revolutionary program? :-)
>
>Per.

```
 0

```perstromgren <stromgren.per@gmail.com> wrote:
>
> What would be your choice of object type for "table" here: list or
> matrix? And what may be a good approach to find a value in the list or

I would use a matrix (array).

> matrix, knowing that the data are sorted, but not every value is
> present?

Some sort of interpolation scheme - the best is dependent on the data.
You need to plot it and choose a method.  You can always get by with
linear interpolation.

- Kurt
```
 0

6 Replies
435 Views

Similar Articles

12/13/2013 1:23:01 AM
page loaded in 4546 ms. (0)

Similar Artilces:

Relationships Between Lookup Tables and Regular Tables
Do I need to create a relationship between fields in a table I created for a lookup(combo box) and the actual table that contains the combo box? Or do these lookup tables exist independently of the main tables? "Mark Lees" <mark_lees@byu.edu> wrote in message news:c4f3d99f.0310151344.206bcf50@posting.google.com... > Do I need to create a relationship between fields in a table I created > for a lookup(combo box) and the actual table that contains the combo > box? Or do these lookup tables exist independently of the main tables? Short answer: Yes - you need to create ...

Exponential curve fitting for mutiple curves
Hi all, I am trying to fit a matrix using exponential function: a+b*exp(-c*x) with the constant c. Problem here is: I do not know c or a or b. I need to fit all the multiple curves first to estimate c. Please help and show me which function or code I should use. Thank you! S You can have a look at the example "fitcurvedemo" the fitting is done for a exponentail function of type A*exp(lambda * x), you will need to a a third parameter to the optimization. "Jing " <jguo4@gsu.edu> wrote in message <ibf49s\$gjt\$1@fred.mathworks.com>... > Hi all, &g...

curve fitting, how to set relationship between fitting parameters
Hello, basically, I'm trying to fit data to the curve a*exp(b)+(1-a)*exp(c) How can I set the condition b<c for matlab to include into the fitting process? Thanks in advance, Tina ...

Lookup Tables
The future of computer architecture will use lookup tables. Currently computer processor speed outweighs the benefits of using computer memory for lookup tables, except in some cases. As computer memory increases, new ROM chips will be built with lookup tables hardcoded into them. Here is an example of what using a lookup table can do for you. The following program divides to integers from 0 to 4 using lookup tables and times itself against the same operation using the division operator in c++. I came up with this idea myself, and met critisism everywhere I brought it up. It is actually ...

Curve fitting
Dear all, I'm thinking about using a GA to find the best-fitting curve(polynomial approx.), passing a point, in a (seismic) image. Does onyone knows whether something like this has been doen before. Thanks, Maurice Hi, I am not sure about polynomial curve fitting, but if piecewise polys are good enough, take a look here: http://www.cs.huji.ac.il/~ronygold/optimal_knot.html The paper deals with adjusting parameterization and knot vector for bspline curve fitting and interpolation. There are some more works about this issue, you can find references in the article. There is a newer ar...

curve fitting
Hello, I am having some trouble fitting a function using curvefit. The function contains two parameters that need to be fitted but also contains two other parameters that don't need to be fitted but have a fixed value. This is not a problem yet, unless you place it in a for loop where the fixed parameters need to be changed when fitting another series of points. I haven't found a way to supply the fittingroutine these variables. Does anyone know of a way to solve this problem. thanks in advance, maarten maarten writes: > I am having some trouble fitting a function using cu...

curve fitting again
A user of my program will be drawing (typically by mouse) a freehand line. The user knows the exact path of this line and only the awkwardness of the mouse should alter its path. That is the ideal case. I need my software to assist in this goal and also be able to measure the length of such a line (say to an accuracy of 0.9 of the bounding box between inflexions). One approach may be to have the user add points and produce a best fit curve. Some times the user will want straight lines between points and other times they will want a curve fitting. I can easily toggle this behaviour. When ...

fitting curve calibration
Hi, I have some a set of coordinates, I managed to draw them & to find their best fitting curve using matlab, the problem is that this curve is nor 1:1 curve, it is subject to magnification, compression, elongation according to how I resize the window. Moreover, when I try to print, it prints what is on the screen, not the real dimensions. How can I fix this problem?? as I need the print out to be in mm in 1:1 scale so I can measure it. "MMM " <mac.kral26@gmail.com> wrote in message <fn43l1\$i7o\$1@fred.mathworks.com>... > Hi, > I have some a set of coordinates...

Curve Fitting #31
Hello all, I want to find my model parameters using lsqcurvefit but I do not know how to give my parameters-bearing function to lsqcurvefit because the equation do not have explicit analytical solutions for S and X as a function of time. So, I need to use an ODE to find S or X to fit to my sets of dependent (S) and independent (time) data pairs. My model is a Monod-type kinetics which for substrate (S) utilization rate is: dS/dt = - Kmax * X * S/ (Ks + S); and for microorganisms(X) growth rate is: dX/dt = - Kmax * Y * X * S/ (Ks + S) where S is substrate concentration (mg/L); X is microorg...

writing into Lookup table
Hi, I have a external systems which sends data of various types I need to store these data as it comes. Which block can I use in simulink. Can I use Look up table ? If yes Can u provide some explanation. Thanks in advance Suraj Kiran ...

which is the correct curve fit?
Hi there, I am trying to find the coefficients a,b,c,d for an equation of the form:- y = a*(x-b)^(c) + d; I am currently trying to use the 'lsqcurvefit' function for this but when i run it i get an error message from within this function where it calls the sub-function 'lsqncommon' saying that there is an error using ^ and that the matrix must be square. Am i using the correct curve fit here? Any suggestions would be most helpful. Regards, Simon "Simon Hall" <s.l.hall@qub.ac.uk> wrote in news:eef54d8.-1 @webx.raydaftYaTP: > Hi there, > > I am t...

how to fit a curve on an image?
i want to fit a parabola shape curve on a low resolution image in order to find the medial axis of the image , how can i do that ? "niloufar " <ndarvish@kth.se> wrote in message <jrf863\$2n\$1@newscl01ah.mathworks.com>... > i want to fit a parabola shape curve on a low resolution image in order to find the medial axis of the image , how can i do that ? You need to first extract the boundary pixels of the image object. The co-ordinates of the boundary pixels will then be used to your curve fitting program. Yumnam Kirani Singh Tronglaobi Awang Leikai "De...

Curve fitting for a matrix
Hello everyone, I have reaction times (RT) data for several subjects, across five different sessions of an experiment, organised in a matrix where each of the five cells of a row represents one subject's performance in each of the five sessions. I tried inputting the matrix as "Y Data" in the Curve Fitting Tool, but apparently it only accepts vectors. Rather than defining a separate vector and running a separate fit analysis for each of my subjects, isn't there a way to make CFT just take each row of the matrix as the "Y Data" vector? Interestingly, I see that Ma...

lookup table #2
How can I implement a 2-D matrix in a lookup table? Is it possible to set a path from a lookup table to the source? What kind of lookup table do I have to use? Thanks for your Help ...

constucting a lookup table
I'm new to Python and want to contruct a "lookup table" which would be similar to a spreadsheet in that a value is read along the first column, then along the top row, and the intersection of the two gives a value that is hard-coded, i.e. not mathmatically related. An example would be a table with HEIGHT in the first column, WEIGHT in the first row, and estimated SUITSIZE with the body of the table. Which Python type would be most appropriate and/or efficient? thanks How about a dictionary, keyed on tuples of (height, weight)? mhodkin@comcast.net wrote: > I'm new to ...

curve fitting #52
I would like to different curvefit methods to fit a speech signal which consists of about 20000 samples. I have already used the inbuilt fit methods in matlab to fit the speech signal. when I used custom equations and defined the equation y=a1*cos(b1*x+c1)+a2*cos(b2*x+c2)+a3*cos(b3*x+c3)+a4*cos(b4*x+c4) the fit was very poor and it is not at all matching with the speech signal. but the inbuilt function f(x) = a1*sin(b1*x+c1) + a2*sin(b2*x+c2) + a3*sin(b3*x+c3) + a4*sin(b4*x+c4) gave a much better fit when compared to above. how to obtain a good quality of fit from the equation which I hav...

3d curve fit
Hi all, I have to fit a 3D curve wich has as X and Y values two pressure coefficients (they have been calculated from a probe calibration). For every value of X and Y corresponds a Value Z wich is an angle. Now what I need is a curve fit wich gives me a formula so that giving the two coefficient X and Y as input i will get the corresponding angle. Can anyone help me? Thanks "Tay " <taytus@hotmail.com> wrote in message news:htm1e7\$mo9\$1@fred.mathworks.com... > Hi all, > > I have to fit a 3D curve wich has as X and Y values two pressure > coeffici...

fitting a curve to data
Hi, What am I supposed to do with the following code (from the Matlab Help) in order to make a fit to exponential + polynomial function: A*exp(lambda * xdata) + B * xdata^2 ? I managed to do it without the parameter B, but with B it doesn't work. function [estimates, model] = fitcurvedemo(xdata, ydata) % Call fminsearch with a random starting point. start_point = rand(1, 2); model = @expfun; estimates = fminsearch(model, start_point); % expfun accepts curve parameters as inputs, and outputs sse, % the sum of squares error for A * exp(-lambda * xdata) - ydata, % and the FittedCurve....

Speaking of curve fitting...
.... run the following code, spot the difference and explain, s'il vous plait. nn = 1000 xx1 = dindgen(nn) xx2 = timegen(nn, start=julday(5,25,1980,11,23)) yy1 = sin(2.*2.*!pi*xx1/(nn-1.)) d = poly_fit(xx1, yy1, 6, yfit=yfit1, /double) d = poly_fit(xx2, yy1, 6, yfit=yfit2, /double) !p.multi = [0,1,2] plot, xx1, yy1, /xstyle oplot, xx1, yfit1, linestyle=1 plot, xx2, yy1,/xstyle oplot, xx2, yfit2, linestyle=1 end I had a quick look at POLY_FIT.PRO but I can spot nothing which could explain the above behaviour. I run 32bit IDL 6.4 on some Linux. Cheers Lasse Clausen Lasse Clausen wrot...

curve fitting #4
Hello, it is a student from istanbul. I have a problem about curve fitting. I have two arrays with five elements in each and one of them decsribes the x axiz and the other one describes y. so as you can guess, i have five different points and i want to apply lineer fit to them. I almost checked all the examples in labview library but unfortunately havent found a solution for my application. I hope someone has an advice about it. &nbsp; King Regards, &nbsp; Emin Ek?i ...