Placing restrictions on spline fits
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Get Started with Curve Fitting Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!