Placing restrictions on spline fits
이전 댓글 표시
I am trying to use the spline function to get a fit for a set of data. My problem is that I need to specify the value for the local minima and I have not been able to find a way to accomplish this. An example code would be what is shown below:
x = -180:90:180;
y = [10 5 1 6 10]
cs = spline(x,[0 y 0]);
xx = linspace(-180,180,181);
yy = ppval(cs,xx);
plot(x,y,'o',xx,yy,'-');
I need to be able to specify that the local minima be 1, but the fit dips below that. I could do this by specifying the x-value for zero slope as well. Please point me in the direction of a function or tool that will allow me to do this. I have tried a few spline fits and pchip, but haven't gotten the curve fitting toolbox yet because I don't want to spend the money if it won't help. It must also be able to be periodic, that is the slope at the endpoints must also be zero.
Thanks
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!