Smoothing spline (spaps)
이전 댓글 표시
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?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!