Re: fitting parameters to a differential equation
- To: mathgroup at smc.vnet.net
- Subject: [mg108546] Re: fitting parameters to a differential equation
- From: dh <dh at metrohm.com>
- Date: Mon, 22 Mar 2010 06:41:37 -0500 (EST)
Hello, here is some code to get GS filter coefficients. l=Filterlength/2, der= derivative (0-> only smoothing), o: Order-> degree of ploy used. GS[l_, der_: 0, o_: 2] := Module[{power, m}, power[x1_, x2_] := If[x1 == x2 == 0, 1, x1^x2]; m = Outer[power[#1, #2] &, Range[-l, l], Range[0, o]]; der! (LinearSolve[Transpose[m].m, Transpose[m]])[[der + 1]] ]; cheesr, Daniel On 21.03.2010 10:33, Virgil Stokes wrote: > On 17-Mar-2010 10:37, dh wrote: >> Hi Eric, >> I think your idea of usein the DE is sound. Nonlinear Fits are usually >> nasty. >> I assume that "I have a noise measurement" actually means: "I have a >> noisy measurement". Otherwise we are out of luck. >> To get the derivative I would use digital filters (assuming the data is >> equidistant) that at the same time smooth and calculate the derivative. >> Which filter you need depends on the amount of noise in your data. A >> very simple to calculate type are called Golay Savitzky filters. >> >> Daniel >> >> On 16.03.2010 10:46, eric g wrote: >>> Hello Group, >>> >>> does this make sense to you?: >>> >>> Suppose I have an second order differential equation on y[t]: >>> y''+ay'+by=0, and I have a noise measurement of {y[t], @t1,t2,....tN}, I >>> would like to fit 'a' and 'b' using the differential equation rather >>> than using the solution. >>> >>> I will proceed like this: >>> >>> * take my y[t1],...,y[tN] measuremenst and do b-splines interpolation (I >>> dont know what is the best way to do this), named yi[t], then find >>> yi'[t], and yi''[t] >>> >>> * then I have an algebraic system on 'a,b' with N-equations (N is a big >>> number) ayi'[t1]+by[t1]=-y''[t1],..... >>> >>> * how to use pseudoinverse to fit 'a' and 'b'? do you think this way may >>> be better that a nonlinear fit (weighted nonlinear regression) using the >>> solution of the equation? Do you think that this way may avoid the >>> problem of finding the appropriate guess for the nonlinear fits >>> algorithms with is ussually an issue? >>> >>> best regards, >>> Eric >>> >>> >>> >> > I wrote a Mathematica notebook about a year ago on LS smoothing for > teaching purposes. This notebook gives some background on the SG > smoother and contains code that can be used to estimate smoothed values > (0th derivative) and derivatives of noisy TS data --- several examples > of smoothing are included. If anyone is interested in this notebook, > then just drop me an email with "SG Smoother" in the subject. > > --V > > > > -- Daniel Huber Metrohm AG International Headquarters Oberdorfstr. 68, CH-9101 Herisau / Switzerland Phone +41 71 353 8606, Fax +41 71 353 89 01 Mail <mailto:dh at metrohm.com> Web <http://www.metrohm.com