• 12
• 12
• 9
• 10
• 13

Mathematical graphing

This topic is 3935 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi... I am looking to find a formula for 2 unknown inputs. Does anyone know of a program that if given a set of empirical data can develop an approximate mathematical formula? For example, Input: Output: (5,5) 5 (5,10) 10 (5,15) 16 (5,20) 24 (10, 5) 9 (10, 10) 10 (15, 20) 70 (20, 5) 19 etc... Any help would be appreciated... Thank you...

Share on other sites
Typically you first pick an equation class you want to use to model the relationship (i.e. Ax + By = C) and then regress the curve to your data. Excel can co do this using linear equations, quadratic equations, exponential equations, etc.

This should also probably be moved to M&P.

Share on other sites
Moving to Math & Physics.

The general class of what you want is known as 'regressions'. Probably the simplest one you want is a linear regression.

Share on other sites
Try gnuplot. It can do curve fitting via the "fit" command. Documentation is available at the gnuplot site. They made a good attempt at it but, as with most open source projects, it is kind of crappy. I think it can do 3D plotting but I'm not sure. MATLAB might be able to, as well.

Here's a gnuplot example:

Make a file called data.dat:

0 5
-2 9
5 30

The first column was X and the second was Y (the output.) We guess that the equation will be a parabola of the form f(x)=a*x**2 + b

Here's the gnuplot .plt file to use:

set term windowsset xlabel "X"set ylabel "Y"set title "Bart's Kickass Example"## Perform curve fit#f(x) = a*x**2+b	# format of the equation to fit toa = 0.5 # provide initial guesses for fitting parametersb = 1.0	FIT_LIMIT = 1e-6 # internal variable controlling limit of convergencefit f(x) 'data.dat' using ($1):($2) via a,b # $1,$2 are columns## Plot and Output to File#plot [-7:7] 'data.dat' using ($1):($2) lt 1 t 'Data' # plot datareplot f(x) lt -1 t 'Fitted Curve' # overlay fitted curveset term png enhanced				# enhanced mode (mixed fonts, etc.), color, force solid linesset output 'comparison_unstrained.png'replotset term windows

I didn't test it but it should work okay.