-3

我有数据

x=[14.0716101600000 17.7292101600000    21.3868101600000    21.3868101600000    25.0444101600000    28.7020101600000    32.3596101600000    36.0172101600000    39.6748101600000    43.3324101600000    46.9900101600000    50.6476101600000    54.3052101600000    57.9628101600000    61.6204101600000    65.2780101600000    68.9356101600000    72.5932101600000    76.2508101600000    79.9084101600000    83.5660101600000    87.2236101600000]

y=[0    0   0   0.152400000000000   0.152400000000000   0.533400000000000   0.685800000000000   0.838200000000000   0.990600000000000   1.14300000000000    1.14300000000000    1.14300000000000    1.29540000000000    1.44780000000000    1.60020000000000    1.75260000000000    1.90500000000000    2.05740000000000    2.20980000000000    2.36220000000000    2.51460000000000    2.66700000000000]

new_x=[21.38,25.03,28.70,32.33,35.99,39.55,45.13,48.80,54.38,58.05];

但是,当我使用interp1喜欢

new_y = interp1(x,y,new_x);

它不起作用。请告诉我为什么。非常感谢!

4

1 回答 1

2

The x vector must be strictly monotonic. In your data, third and fourth elements of x are equal. If you remove, say, fourth element from x and y by

x(4)=[];
y(4)=[];

it works without problem.

于 2013-07-19T20:31:28.830 回答