??? Error using ==> interp1 at 261 The values of X should be distinct. Error in ==> StallPower_20131029_S809 at 10 c=interp1(​rc_table(:​,2),rc_tab​le(:,3),ra​d);

1 view (last 30 days)
When i'm using iterp1 with rc_table, displaying this message
??? Error using ==> interp1 at 261
The values of X should be distinct.
Error in ==> StallPower_20131029_S809 at 10
c=interp1(rc_table(:,2),rc_table(:,3),rad);
What is the problem and its solution, Please?
rc_table :
1 1 0.345899000000000
2 1.50000000000000 0.712727000000000
3 2 0.661241000000000
4 2.50000000000000 0.609755000000000
5 3 0.560511000000000
6 3.50000000000000 0.511266000000000
7 4 0.459780000000000
8 4.50000000000000 0.408293000000000
9 5 0.356807000000000
10 5.50000000000000 0.308684000000000

Accepted Answer

ES
ES on 30 Oct 2013
For your data it works fine. All it says is values in X must be distinct and monotonously increasing. Your X is
rc_table(:,2)
and its values are
1.0000
1.5000
2.0000
2.5000
3.0000
3.5000
4.0000
4.5000
5.0000
5.5000
which are unique and monotonically increasing. If I were you, I would check the data again and check if there is any accidental conversion to integer type.
for example, if you had done int8(rc) somewhere, then interpolation would fail.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!