I have updated my post with an example im working on. The fitted line is a bit off.
–
JavaCakeMay 5 '13 at 13:32

Could you please give us the data too? Then we could try to get a better fit.
–
partial81May 5 '13 at 14:04

Sure, i can give a small sample. Excel fits it perfectly to a power trendline.
–
JavaCakeMay 5 '13 at 14:14

Thanks for the great example. What i dont understand is that my fitted line does not begin from 10 as my points. I need to enter something like {-2000,300,x} which seems ok. I have updated the example with my issue.
–
JavaCakeMay 5 '13 at 20:22

1

Ok, just to summarize: The fit is ok, just the plot not. Do you agree? That is because you plot over a big range. If you use Show[ListPlot[data, PlotStyle -> Red, PlotRange -> All], Plot[modelFit[x], {x, 10, 300}, PlotRange -> All]] you will see that the function fits to the data (without choosing such a big range as above). By the way: If you do not trust your fit, you can use something like Table[{i, modelFit[i]}, {i, 10, 30}]. If you compare the result with your data (or calculate the residual), you will see that the fit is well.
–
partial81May 6 '13 at 7:10

Plot automatically reduces the Plot range depending on the function that is plotted. Adding PlotRange->All shows the function completely in the Plot plot. Show uses the data range from the first plot that is shown, so you eventually need to add a PlotRange->All inside the Show command (depending on your data).

An advice for plotting and fitting power laws:

Often it is better to take the logarithm of the function and the data, or to use a logarithmic scale (LogLogPlot or ListLogLogPlot).

Let's say you have $f(x)=a\cdot x^n$, taking the logarithm leads to:
$$\log(f(x)) = \log(a) + n \cdot \log(x)$$
so you basically get a straight line if you plot $\log(f(x))$ vs. $\log(x)$ and the slope is the exponent $n$. This makes it easier to see deviations.

If the model is linear, you can use LinearModelFit. If the model is nonlinear, then NonlinearModelFit. To see how to apply these, check out the help (F1 on the word LinearModelFit`) where there are plenty of examples.

To mimic the function you've included, you could try something like:

NonlinearModelFit[data, a + b x + c x^n, {a,b,c,n}, x];

Though it also looks like an exponential decay, so you might want to see how that fits as well.

Mathematica is a registered trademark of Wolfram Research, Inc. While the mark is used herein with the limited permission of Wolfram Research, Stack Exchange and this site disclaim all affiliation therewith.