Path: news.mathworks.com!not-for-mail From: "John D'Errico" <woodchips@rochester.rr.com> Newsgroups: comp.soft-sys.matlab Subject: Re: High order discrete differenciation schemes Date: Wed, 21 Jan 2009 18:25:18 +0000 (UTC) Organization: John D'Errico (1-3LEW5R) Lines: 41 Message-ID: <gl7pae$i7c$1@fred.mathworks.com> References: <gl7dml$cdd$1@fred.mathworks.com> Reply-To: "John D'Errico" <woodchips@rochester.rr.com> NNTP-Posting-Host: webapp-03-blr.mathworks.com Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1232562318 18668 172.30.248.38 (21 Jan 2009 18:25:18 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Wed, 21 Jan 2009 18:25:18 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 869215 Xref: news.mathworks.com comp.soft-sys.matlab:512996 "John Deas" <john.deas.smash.spam@gmail.com> wrote in message <gl7dml$cdd$1@fred.mathworks.com>... > Hi, > > I used the builtin gradient function to quickly compute partial derivatives in a matrix representing my evenly spaced data (I am working on entropy production in heat exchangers). Gradient use a first order centered derivative, and I would like to check the sensibility of the final results of my computation against other discretisation scheme and order. > > It seems that there is a possibility to model data using splines then differentiate it, and, increasing the order of the spline will increase the differentiation order. > > As this is a collateral aspect of my research, I would like to know if sombedy can point out to a readily available solution to the problem ? If you have the spines toolbox, this takes not much more than a call to fnder after the spline interpolant is chosen. If you don't have the splines toolbox, then you have two options. One is the high order finite difference approximations, which you would need to code yourself. The second option is a Savitsky-Golay filter. I can offer my own movingslope code from the file exchange. It allows you to control the order of the method. In my code, if you specify supportlength such that it is 1 more than modelorder, then the code will effectively use a Lagrange interpolating polynomial to estimate your derivatives. For example, a 4th order model, with a corresponding supportlength of 5, will give you an implicit sliding quartic polynomial fit. The effective order of the derivative estimator will be 4. A 2nd order model, with a support length of 3 will yield the standard central finite difference approximation for the derivative. http://www.mathworks.com/matlabcentral/fileexchange/16997 I believe there are other Savitsky-Golay variants on the FEX too. HTH, John