Let's say I have some data, as a function of a variable [itex]x[/itex]. I want to fit this to the real part of the function(adsbygoogle = window.adsbygoogle || []).push({});

[tex]\frac{A}{1-ix}\left(1+\sum_{n=1}^\infty\frac{c_n}{(1-ix)^n}\right)[/tex]

by numerically fitting the first [itex]N[/itex] of the [itex]c_n[/itex]'s ([itex]A[/itex] is fixed). I tried something like

However, this way does not work. For the case [itex]N=5[/itex], I put in the summation explicitly, calling my parameters c1, c2, etc, and it produces different (better) results than the above code. This is not feasible if I want the first 100 or 1000 coefficients, so any help with the above method would be appreciated. Thanks in advance.Code (Text):

A = 1; N = 100;

fit = FindFit[data, Re[A(1+Sum[c[k]/(1-i x)^k,{k,1,N}])], Table[c[k], {k,1,N}], x];

Plot[Re[A(1+Sum[c[k]/(1-i x)^k,{k,1,N}])]/.fit, {x,0,10}]

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Mathematica, fitting an arbitrary number of parameters

Loading...

Similar Threads - Mathematica fitting arbitrary | Date |
---|---|

Fitting Data Imported into Mathematica from Excel | Oct 15, 2012 |

Mathematica: Listplot & Non linear fitting | May 20, 2012 |

Mathematica: parabolic fit | May 14, 2012 |

Origin fit plotted on mathematica | Oct 30, 2011 |

Curve fitting in Mathematica with FindMinimum function | Jun 9, 2011 |

**Physics Forums - The Fusion of Science and Community**