# curve fitting problem

Hi,

This might be quite complicated to explain so please bear with me! I
have a fucntion which requires that 9 values are calibrated so that it
best matches estimates from a data file.

The data file simply has:

day of year estimated values
57 -0.35
63 -0.45
74 -0.56 etc

The function with the 9 values should produce similar values to the
estimated values given other inputs - the function is quite complex ...

f(x) = (((((a7 * \$11**2) / (\$11**2 + a9)) * \$6 * ((abs(\$7)**a10) /
((0.5 * 15.22) + (a6 * \$9)))) * (\$8 - (0.5 * ((\$8 + (a3 - a4) - (((a1 *
\$10 * \$11) / ((abs(\$7)**a10) / ((0.5 * 15.22) + (a6 * \$9)))) * exp (\$3
* a8))) + (sqrt(((\$8 + (a3 - a4) - (((a1 * \$10 * \$11) / ((abs(\$7)**a10)
/ ((0.5 * 15.22) + (a6 * \$9)))) * exp (\$3 * a8)))**2) - (4 * ((\$8 * (a3
- a4)) - ((((a1 * \$10 * \$11) / ((abs(\$7)**a10) / ((0.5 * 15.22) + (a6 *
\$9)))) * exp (\$3 * a8)) * a3))))))))) / (((a7 * \$11**2) / (\$11**2 +
a9)) * \$6) + (((abs(\$7)**a10) / ((0.5 * 15.22) + (a6 * \$9))) * (\$8 -
(0.5 * ((\$8 + (a3 - a4) - (((a1 * \$10 * \$11) / ((abs(\$7)**a10) / ((0.5
* 15.22) + (a6 * \$9)))) * exp (\$3 * a8))) + (sqrt(((\$8 + (a3 - a4) -
(((a1 * \$10 * \$11) / ((abs(\$7)**a10) / ((0.5 * 15.22) + (a6 * \$9)))) *
exp (\$3 * a8)))**2) - (4 * ((\$8 * (a3 - a4)) - ((((a1 * \$10 * \$11) /
((abs(\$7)**a10) / ((0.5 * 15.22) + (a6 * \$9)))) * exp (\$3 * a8)) *
a3)))))))))) * ((a2 * ((24 * acos ((-tan(45 * (3.14159265 /180))) *
(tan(-0.408 * cos (((360.0 * (\$2 + 10.0)) / 365.0) *
(3.14159265/180)))))) / (3.14159265))) + a5)

I couldn't see how you could enter it as seperate equations into
gnuplot so I made it into one large function.

So I set up the initial guesses at the 9 values - a1 -a9

gnuplot > a1 = 2.155; a2 = 1.1; a3 = 2.9; a4 = 2.3; a5 = 1.6; a6 =
2.653; a7 = 4.309; a8 = 3.2; a9 = 1.062; a10 = 2.2;

entered the above function

and then asked gnuplot to fit the function

gnuplot> fit f(x) "filename" using 2:1 via a1, a2, a3, a4, a5, a6, a7,
a8, a9, a10

and GNUPLOT said --> Undefined value during function evaluation

Now I think I may have misunderstood how this works ? when above I said
using 2:1 thats where in the data file I have

day of year estimated values
57 -0.35
63 -0.45
74 -0.56 etc

Any help would be much appreciated
thanks,

Martin.

.

## Relevant Pages

• oocalc does not directly import .dat files
... First row contains the first array, second row contains second array, ... But if I want to visualize this data using gnuplot (my favorite plotting ... So now I have to find a software which will transpose the data file. ... But my data files usually have a .dat ...
(Debian-User)
• Re: interpolation in splot
... I have a data file of the following form: ... can't be done in gnuplot. ... linear interpolation outside of gnuplot to make the grid more dense. ... or if you wanted to get fancier, you could do a bicubic spline for the ...
(comp.graphics.apps.gnuplot)
• Re: Appending data to existing plot
... it would be possible to add a single datapoint to an existing ... An existing data file or an existing output file? ... Gnuplot has no problem with the former - just hit "replot" and it will ... Is there a requirement to update the plot for every new point, ...
(comp.graphics.apps.gnuplot)
• Re: gnuplot terminal bug (postscript eps)
... I have the following gnuplot script and data file, ... eps with error(gv it would give error, and epstopdf it would give ... The version is gnuplot 4.2 patchlevel rc1. ... help to check if the latest version of gnuplot can generate the eps ...
(comp.graphics.apps.gnuplot)
• Re: Turn off axes completely
... Incidentally, I am calling pgnuplot from c# .net code, here's how I did it, ... // Write ascii pixel data to a gnuplot matrix data file ... // deletes data file if it already exists ... TDLog.T_WriteLine("Plotting to file ''", gpOutputFileFullPath); ...
(comp.graphics.apps.gnuplot)