# How to fit a data set in an iterative way?

I am going to fit a data set in the following way. I have a data set $y$ vs. $x$. $y$ is again a function of $t$ i.e. $y=f(t)$. With varying $t$, I can get different $y$ and can plot $y$ vs. $x$, and fit each plot to find the fitting parameters. I need all the fitting parameters with varying $t$. I have used code like this:

dataf = Table[FindFit[data, a + b*i, {a, b}, i], {i, 1, 5}]


• Hi Partha. It's not entirely clear to me what you are trying to achieve there. Could you please provide an example data set for data? Do you mean that your model looks like y[[i]] = f(x[[i]],t) with lists x and y prescribed and t being a further parameter? Jun 2, 2018 at 13:08
• Err... sorry for using incorrect syntax. I meant $y_i = f(x_i,t)$ (or y[[i]] == f[x[[i]], t]). Jun 2, 2018 at 13:20
• You have i serving two different roles here. You're telling FindFit that it's the independent variable in the fitting formula, but then you're trying to use it as a Table index, too. I can't understand what you're attempting. Jun 2, 2018 at 13:43
• My entire equation looks like: fit = Table[ FindFit[Transpose[{[Nu], (NormalisedIntensity/ avglifetime)*([Tau][[1]]*Exp[-t/[Tau][[2]]] + [Tau][[3]]* Exp[-t/[Tau][[4]]] + [Tau][[5]]*Exp[-t/[Tau][[6]]])}], h*Exp[ -(0.693)*( Log[1 + 2*a*([Nu] - n)/d]/a )^2] , {a, d, n, h}, t], {t, 0, 2}] Jun 2, 2018 at 13:44
• – kglr
Jun 2, 2018 at 14:19

SeedRandom[1]