How to fit a non-linear expression of type $Y=A(1-e^{-t/B})$ to the data set without using any package? [duplicate]

I am a newbie in statistics. I have collected data for a parameter Y at different time t. I would like to fit a function $$Y=A(1-e^{-t/B})$$. I have to determine A and B. I am not able to use conventional methods.

P.S. The function is asymptotic to a line $$Y=A$$ or you can say that $$Y$$ will attain the value $$A$$ at time infinity.

• This a FAQ with many detailed answers: see stats.stackexchange.com/search?q=nonlinear+regression+exp and curve fitting. – whuber Nov 6 '19 at 13:43
• mine is a bit different, I guess. not able to handle the term: $(1-exp(-t/B))$ – Wings Nov 6 '19 at 13:53
• I selected the duplicates because they explicitly handle that case. – whuber Nov 6 '19 at 13:55
• @whuber, the first one you suggested has an exactly same plot of fit, but I do not want it through R. I want to write my own code. – Wings Nov 6 '19 at 14:54
• That's laudable--but how to write your own code is not on topic here. I'm pretty sure you can find posts about nonlinear regression that don't use any "package" at all: they implement the solution using basic numerical methods available in almost any scientific or statistical computing platform or they describe the solutions mathematically. You may find some of those useful guides to your own work. – whuber Nov 6 '19 at 19:07