MATLAB Answers

Pranav
0

Determining the time(x-value) if a exponential function reaches a specific value using fit or any other funtion

Asked by Pranav
on 2 Aug 2017
Latest activity Commented on by Pranav
on 3 Aug 2017
Hi all, Is it possible to determine the time(x value) at which a nonlinear function reaches a specific value. The curve is nonlinear. How about curve fitting to exponential curve. How could the command fit and fitoptions be helpful in finding the x value ? Please guide

  0 Comments

Sign in to comment.

1 Answer

Answer by John D'Errico
on 2 Aug 2017

Why would you need to approximate a given function using another (exponential) function, and only then solve for a time?
Use fzero, assuming that you already have a function.
Is it that you only have data points? Then you will need to postulate a model. How can we know if an exponential is right for your problem though? Only you know that. Anyway, if so, then you already know you need to use fit, so wtp? read the help and examples for the curve fitting toolbox.

  3 Comments

John, Thanks for your reply...
I have only the certain number of data points from feedback data array(say 6 sample points). And since I have a mechanical spring system, I need to check if the data points could be approximated to exponential curve each sim cycle.
From these data points , I need to find/predict at what time the next value would reach specific value, (say 100)(ie I need to find the x or time stamp if y = a.exp(bx)) ??
Also I know how the curve fitting is done but i need help in predicting the time using some method for exp curve.
I don't understand why you are having a problem. Just use fit. I assume the fittype will be exp1.
At that point, it is basic algebra.
divide 100 (your target) by a.
take the log.
divide by b.
Do you not know how to extract the coefficients from a fit? Use methods to tell you what methods are available. Something like coeffvalues as I recall will do the trick there, but methods will tell you.
Thanks again.
I understand how the coeffs can be found by using available example models. But what I am trying is to avoid the algebra and find x using predint cmd or other cmds using the coeffs given by fit.

Sign in to comment.