From: Lei Zhang on 7 Jun 2010 04:09 Hi, everyone Here’s my question. I’ve got some discrete data, (xi,yi), i=0,1,2, …,n, where xi are monotonically increasing and belong to interval [a,b]. I want to do some spline approximation job(with spline toolbox) to fit the data, but the difficulty lies in: first, there are some end conditions I want the spline approximation function s(x) to satisfy, which may be specified like this: D^2s(a)=D^2s(b)=0 and D^3s(a)=D^3s(b)=0. second, the order of the spline approximation maybe greater than cubic, because I want to get first to fourth derivative of s(x). I think 6 or 7 may be appropriate. How to make s(x) satisfy these end conditions when using spline approximation with order 6 or 7? Thanks for your attention and response Zhang Lei
From: Bruno Luong on 7 Jun 2010 05:31 Example of code: % Data x = linspace(-4,4); y = exp(-x.^4-2*x+3); % Add some noise sigma = 0.5; y = y+sigma*randn(size(y)); % Engine ab = [min(x) max(x)]; % left and right bracket k = 7; % piecewise 6th order polynomial spline % structure used to enforce the 2nd and 3rd derivatives on left/right bound dcon = struct('p', {2 3}, 'x', ab, 'v', 0); options = struct('KnotRemoval','none',... 'pntcon', dcon,... 'Animation', 1); pp = BSFK(x, y, k, [], [], options); % Bruno
From: Bruno Luong on 7 Jun 2010 07:18 "John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <huiev7$7b3$1(a)fred.mathworks.com>... > > You are fooling yourself, if you think that those high > order derivatives mean anything at all. They will be > almost random numbers. > > The thing is, high order derivatives are contaminated > by any noise in the data. Differentiation is an ill-posed > problem, and multiple orders of differentiation are > then very ill-posed. ANY noise in the data becomes > highly magnified, so that the 4th derivative is useless. > > Feel free to be a fool here. It is your data after all. John get the point here. It is perhaps meaningless trying compute something accurately with high order derivative in many cases. But in some applications, the derivative can be used simply to enforce some smoothness in the numerical solution, such as high viscosity terms presented in some PDEs. In that case I can imagine why computing a 4th derivative is still justified. Bruno
|
Pages: 1 Prev: solve an equation and get real&greater than zero root Next: bayer pattern histogram |