Interpolation Error using interp1
Mostra commenti meno recenti
I'm using a script to take these x and y values from a .txt file. At this point in the script the variables are assigned the fid is closed... When I code further, I'm trying to interpolate a user entered value which is called 'userx'.
Below, though, I am just trying to get it to interpolate at 100. I don't understand where my syntax error is.
>> x
x =
0
20
22
30
33
52
52
67
84
101
103
111
116
132
141
159
162
168
171
173
>> y
y =
8477
11886
11384
6087
7871
3003
1941
9213
10981
2179
2219
507
1593
8880
11650
4392
6118
4437
2094
1961
>> interp1(x,y,100) Error using interp1 (line 130) Values must be of type double or single.
>>
Risposta accettata
Più risposte (1)
Image Analyst
il 29 Apr 2015
Try
x = double(x);
y = double(y);
to make sure they're doubles like interp1() said it wanted.
Categorie
Scopri di più su Data Type Conversion in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!