Smoothing spline (spaps)
Show older comments
Hi, I've got a question concerning the behaviour of the 'spaps' function (smoothing spline in curve fitting toolbox). It works as expected if the input vector contains large numbers, but does not seem to work for small numbers. An example:
This behaves as I would expect it:
x = 1:20;
y = 10 + 2*randn(20,1);
tol = ones(20,1);
sp = spaps(x,y,tol); % smoothing spline
subplot(2,1,1)
errorbar(x,y,tol,'LineStyle','none');
hold on
xi = 1:0.1:20;
plot(xi,fnval(sp,xi),'r');
title('spaps(x,y,tol)')
hold off
Now the same as above, but the y and tol values multiplied by 0.01. I would expect the same curve as above (also multiplied by 0.01), but instead the smoothing parameter is 0 resulting in a straight line fit.
scale = 0.01;
y = y*scale;
tol = tol*scale;
sp = spaps(x,y,tol);
subplot(2,1,2)
errorbar(x,y,tol,'LineStyle','none');
hold on
xi = 1:0.1:20;
plot(xi,fnval(sp,xi),'r');
title('spaps(x,0.01*y,0.01*tol)')
hold off
Why is 'spaps' not scaleable?
Accepted Answer
More Answers (0)
Categories
Find more on Spline Postprocessing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!