Re: How to solve or approximate a first order differential equation ?
- To: mathgroup at smc.vnet.net
- Subject: [mg123224] Re: How to solve or approximate a first order differential equation ?
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Sun, 27 Nov 2011 04:13:56 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
Clear[y]; data = {{1, 0.033}, {2, 0.054}, {5, 0.088}}; With[{C = 1/9}, Column[{ model = DSolve[ {y'[t] == -A (y[t])^2 + B (C - y[t]), y[0] == 0}, y[t], t][[1]], param = FindFit[data, y[t] /. model, {A, B}, t], Plot[y[t] /. model /. param, {t, 0, Max[data[[All, 1]]]}, ImageSize -> 400, AxesLabel -> {"t", "y[t]"}, Epilog -> {Red, AbsolutePointSize[5], Point[data]}]}]] // Quiet Bob Hanlon On Sat, Nov 26, 2011 at 5:09 AM, Dino <dinodeblasio at gmail.com> wrote: > Hello everyone, > > I have this first order differential equation: > > y'[t] = -A (y[t])^2 + B (C - y[t]) > > where A and B are unknown constants and C is known constant. > One condition is y[0]==0 > > A and B should be determined by fitting a list of {y[i],t[i]} values. > > For this reason i would like to approximate my differential equation > with a function which I could use to fit the data and find A and B. > > I don't know how to do this. > Any help is highly appreciated. > > Thanks,