# fit funtion to the Sun electron fluxes data

I'd like to fit a function to the Sun's electrons flux data (blue dots), please note that x,y axis are in the log scale. The green dots are the "best" fit from the gnuplot program. I have taken the a/x as a test function, but in the log scale that is a linear function. Could anyone give me advice which test function should I take? Great thanks for any advice:)

-
BTW---$ax^b$ is a line when plotted log--log and collectively these are called "power laws". –  dmckee Jul 20 '12 at 15:13

It would be helpful to include what the x/y axes represent -- the physics of the problem may suggest an answer.

For a generic approach you could just (explicitly) construct $y'=\ln y$, $x'=\ln x$ and then do polynomial fits to this data $x',y'$.

A functional form that might be worth considering is $y = c x^{a +b x}$ which could give you the curvature you're seeing in the log-log plot, but I'd only go there if there was some physical motivation for the $x^{bx}$ behaviour.

-
the x axis is an energy [MeV] of electrons; y axis is a flux e- cm^-2 s^-1. –  nykon Jul 20 '12 at 14:38

In general you don't want to be thinking "How do I fit to this data set?", but rather "What physics do I suspect here and how should I parameterize it?" so that your fit is physically meaningful.

-
You probably have too few points to get a physically significant fit. To get the curvature on the log scale you might try $$\ln(y)=a\left(\ln(x)\right)^2+b\ln(x)+c,$$ i.e. fitting a parabola to those points, but it's unclear that that will give you anything of value (it gives the model $y=Cx^{b+a\ln(x)}$ which is pretty ugly).