From: Bruno Luong on 31 Mar 2010 12:30 Let's try one more time. Below isa better code. The interpolation result is here: http://i44.tinypic.com/a5f5te.png %%%% % Data r = (-7:7); sigma = 3; PSF = exp(-0.5*(r/sigma).^2); % Pad 0 r = [-15 r 15]; PSF = [0 PSF 0]; % Number of subintervals at two ends (1 previously is too coarse to capture the shape of the data) m = 5; % Total number of subintervals n = length(r)-3+2*m; % Constraints derivative>0 at two ends lod = -inf(1,n); lod(1+(0:m-1)) = 0; upd = +inf(1,n); upd(end+(1-m:0)) = 0; shape = struct('p', 1, ... 'lo', lod, ... 'up', upd); opt = struct('KnotRemoval','none', ... 'shape', shape, ... 'lambda', 1e-6, ... 'regmethod', 'discrete'); % Fit with BSFK % http://www.mathworks.com/matlabcentral/fileexchange/25872 pp = BSFK(r, PSF, [], [m n-2*m m], r([2 end-1]), opt); % Graphical check ri = linspace(min(r),max(r),257); fi = ppval(pp,ri); subplot(2,1,1); plot(r,PSF,'ro',ri,fi,'b'); [X Y] = meshgrid(-7:7,-7:7); R2D = sqrt(X.^2 + Y.^2); F = ppval(pp, R2D); subplot(2,1,2); surf(X, Y, F); % Bruno
From: Matt J on 31 Mar 2010 13:42 "Royi Avital" <RoyiREMOVEAvital(a)yahoo.com> wrote in message <hovgp5$di1$1(a)fred.mathworks.com>... > Look at the original post, all I need is to interpolate and extrapolate over the vector 'r' assuming Monotonic Decreasing and Non Negative assumptions for the extrapolation. ========= Come to think of it, why don't you just extrapolate by zero-padding LSF? A tail of zeros is both non-negative and montonic, and therefore satisfies your requirements.
From: Bruno Luong on 31 Mar 2010 13:57 "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hp01ha$i53$1(a)fred.mathworks.com>... > > Come to think of it, why don't you just extrapolate by zero-padding LSF? A tail of zeros is both non-negative and montonic, and therefore satisfies your requirements. This doesn't work: the fact that the data are monotonic does not necessary imply the interpolation function is monotonic. The Hermit's interpolation fulfills this shape preserving" but the result is only first order differentiable. Bruno
From: Matt J on 31 Mar 2010 14:03 "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hp02dv$293$1(a)fred.mathworks.com>... > "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hp01ha$i53$1(a)fred.mathworks.com>... > > > > > Come to think of it, why don't you just extrapolate by zero-padding LSF? A tail of zeros is both non-negative and montonic, and therefore satisfies your requirements. > > This doesn't work: the fact that the data are monotonic does not necessary imply the interpolation function is monotonic. ======================= It does if linear interpolation is used. There's no reason not to do so as far as we've been told.
From: Bruno Luong on 31 Mar 2010 14:07
"Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hp02pa$7qc$1(a)fred.mathworks.com>... > > > It does if linear interpolation is used. There's no reason not to do so as far as we've been told. Look at the graphic link from OP, he did try both linear and pchip (Hermit) and obviously he is not satisfied. Bruno |