ERROR in cubic spline interpolation
Mostrar comentarios más antiguos
I have tried this code a thousand times but I get the same error always.
x = [0 0.0901 0.1803 0.2704 0.3606 0.4507 0.5408 0.6310 0.7211 0.8112 0.9014 0.9915 1.0817 1.1718 1.2619 1.3521 1.4422 1.5323 1.6225 1.7126 1.8028 1.8929 1.9830 2.0732 2.1633 2.2534 2.3436 2.4337 2.5239 2.6140 2.7041 2.7943 2.8844 2.9746 3.0647 3.1548 3.2450 3.3351 3.4252 3.5154 3.6055 3.6957 3.7858 3.8759 3.9661 4.0562 4.1463 4.2365 4.3266 4.4168];
y = [ 0 0.0008 0.0031 0.0070 0.0125 0.0195 0.0280 0.0380 0.0496 0.0627 0.0773 0.0934 0.1111 0.1303 0.1512 0.1737 0.1978 0.2236 0.2510 0.2797 0.3095 0.3396 0.3690 0.3965 0.4202 0.4382 0.4488 0.4509 0.4441 0.4292 0.4078 0.3818 0.3529 0.3227 0.2924 0.2627 0.2340 0.2066 0.1804 0.1556 0.1323 0.1104 0.0900 0.0712 0.0540 0.0385 0.0249 0.0135 0.0044 0];
z=linspace(0,1,50);
pp=spline(x,y);
yy=ppval(pp,z);
ERROR : ??? Error using ==> histc Edge vector must be monotonically non-decreasing.
Error in ==> ppval at 67 if lx, [~,index] = histc(xs,[-inf,b(2:l),inf]);
Please help !!!
Respuestas (1)
Image Analyst
el 21 de Dic. de 2013
I copied and pasted and had no error whatsoever:
x = [0 0.0901 0.1803 0.2704 0.3606 0.4507 0.5408 0.6310 0.7211 0.8112 0.9014 0.9915 1.0817 1.1718 1.2619 1.3521 1.4422 1.5323 1.6225 1.7126 1.8028 1.8929 1.9830 2.0732 2.1633 2.2534 2.3436 2.4337 2.5239 2.6140 2.7041 2.7943 2.8844 2.9746 3.0647 3.1548 3.2450 3.3351 3.4252 3.5154 3.6055 3.6957 3.7858 3.8759 3.9661 4.0562 4.1463 4.2365 4.3266 4.4168];
y = [ 0 0.0008 0.0031 0.0070 0.0125 0.0195 0.0280 0.0380 0.0496 0.0627 0.0773 0.0934 0.1111 0.1303 0.1512 0.1737 0.1978 0.2236 0.2510 0.2797 0.3095 0.3396 0.3690 0.3965 0.4202 0.4382 0.4488 0.4509 0.4441 0.4292 0.4078 0.3818 0.3529 0.3227 0.2924 0.2627 0.2340 0.2066 0.1804 0.1556 0.1323 0.1104 0.0900 0.0712 0.0540 0.0385 0.0249 0.0135 0.0044 0];
z=linspace(0,1,50);
pp=spline(x,y);
yy=ppval(pp,z)
Categorías
Más información sobre Splines en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!