curve fitting - Matlab: Getting the Coefficients of Piecewise Cubic Hermite Interpolating Polynomial -


i want fit curve data. used pchip interpolation because of getting best results. moreover, want coefficients 6 intervals ppval-function. there pops error these:

error using unmkpp (line 18) input array not seem describe pp function.  error in ppval (line 62) [b,c,l,k,dd]=unmkpp(pp);  error in sa (line 8) v = ppval(p,xdata) 

this code:

clear xdata = [0; 3.5; 6.8; 7.6; 8.2; 30; 34.2]; ydata = [0; 50; 400000; 2000000; 25000000; 100000000;100000000] xq1 = 0:0.01:35;  p = pchip(xdata,ydata, xq1); s = spline(xdata,ydata,xq1); v = ppval(p,xdata) plot(xdata,ydata,'o',xq1,p,'-',xq1,s,'-.'); legend('datenpunkte','pchip','spline','location','southeast'); 

can me?

best regards dominik

pchip has 2 working modes:

  • calculating piecewise polynomial coefficients: pp = pchip(x,y):

    returns piecewise polynomial structure use ppval

  • interpolating @ specified points: p = pchip(x,y,xq):

    is same p = ppval(pchip(x,y),xq)

    returns vector of interpolated values p corresponding query points in xq

so, using second mode, not suited use ppval.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -