I Fit a non-linear function to this time series

MacIntoShiba
Messages
7
Reaction score
1
TL;DR Summary
Fit non-linear function to a time series
I have an experimantally obtained time series: n_test(t) with about 5500 data points. Now I assume that this n_test(t) should follow the following equation:
n(t) = n_max - (n_max - n_start)*exp(-t/tau).

How can I find the values for n_start, n_max and tau so as to find the best fit to the n_test(t) time series? I am aware that with Matlab this could be accomplished with fminsearch, however I would like to implement something in Excel.
 
Physics news on Phys.org
Excel should find exponential fit functions, too. Not sure about the offset, however.
You can also define "best fit" manually by calculating the fit quality as function of these parameters (in any way you like) and then use the solver to minimize that cell by changing the three parameters.
 
Excel is not really working along, doesn't have a usefull trendline I can plot through it. The solver doesn't really work either. Ill now finding the paramters by hand. For now that will suffice, this is not a daily recurring task.
 
MacIntoShiba said:
Summary:: Fit non-linear function to a time series

I have an experimantally obtained time series: n_test(t) with about 5500 data points. Now I assume that this n_test(t) should follow the following equation:
n(t) = n_max - (n_max - n_start)*exp(-t/tau).

How can I find the values for n_start, n_max and tau so as to find the best fit to the n_test(t) time series? I am aware that with Matlab this could be accomplished with fminsearch, however I would like to implement something in Excel.
I don't get the formula - is nmax supposed to be the max between start and t? if so, when is the max ever anything but the start as you begin by subtracting n start from itself? Then if nstart >0 each iteration of the exponential term remains zero - you never get a value to multiply by the exponential.
 
Last edited:
BWV said:
I don't get the formula - is nmax supposed to be the max between start and t? if so, when is the max ever anything but the start as you begin by subtracting n start from itself? Then if nstart >0 each iteration of the exponential term remains zero - you never get a value to multiply by the exponential.
A better name for n_max is n_end. Thus in the beginning the concentration is n_start, after an infinite amount of time it's n_max (or n_end, better name).
 
MacIntoShiba said:
A better name for n_max is n_end. Thus in the beginning the concentration is n_start, after an infinite amount of time it's n_max (or n_end, better name).
Why the minus term? Can’t you model it as simple exponential decay, then you can linearize by taking the log
 
MacIntoShiba said:
Excel is not really working along, doesn't have a usefull trendline I can plot through it. The solver doesn't really work either. Ill now finding the paramters by hand. For now that will suffice, this is not a daily recurring task.
That problem description doesn't help understanding what went wrong.
 
Back
Top