Using Interp1 - monotonic increasing values
Ältere Kommentare anzeigen
Hi
I am trying to interpolate physiological values for a study I have run - values for blood pressure, HR and saturations.
I have created a text file and trying to use a script I have used before to run the interpolation.
Text file is:
0 101 51 98 71
5 0 0 97 71
10 103 50 97 73
15 0 0 98 72
20 93 51 98 73
25 0 0 98 73
30 95 52 98 73
35 0 0 98 72
40 94 50 97 73
45 0 0 97 73
50 97 55 97 69
55 0 0 98 60
60 87 51 98 61
65 0 0 98 61
70 89 50 98 60
75 0 0 98 61
80 92 54 98 61
85 0 0 97 61
90 91 51 98 62
95 96 56 98 64
100 0 0 98 64
105 94 54 98 61
110 0 0 98 60
115 95 51 97 60
120 0 0 98 61
125 99 54 98 61
130 0 0 98 61
135 93 52 97 61
140 0 0 98 61
145 92 50 98 61
150 0 0 98 62
155 92 57 97 65
160 0 0 98 65
165 94 50 97 67
170 0 0 98 65
175 95 57 98 69
180 0 0 98 64
185 94 50 98 59
190 0 0 98 53
195 95 57 99 52
200 0 0 98 63
205 98 59 98 58
210 0 0 97 59
215 97 59 97 64
220 0 0 98 64
225 98 50 98 64
230 0 0 99 64
235 98 59 97 65
240 99 66 98 64
Script is:
close all
clear all
A = load(uigetfile());
time = A(:,1);
SBP = A(:,2);
DBP = A(:,3);
sats = A(:,4);
hr = A(:,5);
x = SBP;
y = time;
start=min(time);
finish=max(time);
xi=(start:0.001:finish);
yi=interp1(x,y,xi,'linear');
But getting error:
Error using griddedInterpolant
The grid vectors are not strictly monotonic increasing.
Error in interp1 (line 191)
F = griddedInterpolant(X,V,method);
Error in interpolate_lab_values (line 34)
yi=interp1(x,y,xi,'linear');
Have tried everything I can think of and find on the net but no luck
Thanks loads!
Akzeptierte Antwort
Weitere Antworten (1)
nl2605
am 14 Mär. 2014
1 Stimme
Ohh I see now. Many of your data points are the same and not monotonically increasing or so.
Perhaps this will help. 'unique' function will omit the repeated values. But all the data points are equally important for you I guess?
Then maybe 'griddatan' would work for you.
2 Kommentare
Monty
am 14 Mär. 2014
John D'Errico
am 14 Mär. 2014
griddatan does NOT work with replicates.
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

