"Protyush " <protyushsahu@gmail.com> wrote in message <l94o0r$jn2$1@newscl01ah.mathworks.com>...
> 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 !!!
Hmm.
Thats funny, since I see this:
yy=ppval(pp,z);
yy
yy =
Columns 1 through 17
0 0.0001 0.0002 0.0004 0.0007 0.0010 0.0014 0.0020 0.0025 0.0032 0.0040 0.0048 0.0057 0.0067 0.0078 0.0090 0.0102
Columns 18 through 34
0.0116 0.0130 0.0145 0.0160 0.0176 0.0194 0.0211 0.0230 0.0249 0.0270 0.0291 0.0312 0.0335 0.0358 0.0382 0.0407 0.0433
Columns 35 through 50
0.0459 0.0487 0.0515 0.0544 0.0573 0.0604 0.0635 0.0667 0.0699 0.0733 0.0767 0.0802 0.0838 0.0874 0.0912 0.0950
Works fine for me. I think something is not as you claim.
john
> 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 !!!
Hmm.
Thats funny, since I see this:
yy=ppval(pp,z);
yy
yy =
Columns 1 through 17
0 0.0001 0.0002 0.0004 0.0007 0.0010 0.0014 0.0020 0.0025 0.0032 0.0040 0.0048 0.0057 0.0067 0.0078 0.0090 0.0102
Columns 18 through 34
0.0116 0.0130 0.0145 0.0160 0.0176 0.0194 0.0211 0.0230 0.0249 0.0270 0.0291 0.0312 0.0335 0.0358 0.0382 0.0407 0.0433
Columns 35 through 50
0.0459 0.0487 0.0515 0.0544 0.0573 0.0604 0.0635 0.0667 0.0699 0.0733 0.0767 0.0802 0.0838 0.0874 0.0912 0.0950
Works fine for me. I think something is not as you claim.
john