Spline Error - The first input must contain unique values
Show older comments
Hi,
I am proccessing data from the physionet Staff III database. I take the data, apply a bandpass filter and then apply cubic spline interpolation with the 'Spline' function. For the vast majority of data (~80%) this works well (I will include a list of the troublesome data below).
The error is listed as:
Error using chckxy (line 50)
The first input must contain unique values.
Error in spline (line 72)
[x,y,sizey,endslopes] = chckxy(x,y);
Error in Final_Year_Project_0_1_2>cubicspline (line 491)
yy = spline(x,twelveLead_9(lowers-20,i),xx);
My code to preform the cubic spline interpolation:
x = lowers; % isoelectric point from ecg
xx = 0:1:length(twelveLead_9); % Generate x-axis for the length of the data
splineData =[]; % Empty array for storage of data
for i = 1:9 % For each of the individule leads/channels
yy = spline(x,twelveLead_9(lowers-20,i),xx); % Calcualte the spline
splineData = vertcat(splineData, yy); % Create an array of spline per lead
end
splineDataT = splineData.'; % Transpose array to match orignal data
ecgDataNoSpline = (twelveLead_9 - (splineDataT(1:length(twelveLead_9),:))); % Subtract the 9 splines from the 9 leads
Looking at the first 20 patients on the staff III database (001a-020f) the files that do not work are (002e, 009c, 010c, 011b, 011c, 011d, 013b, 013c, 013d, 013e, 013f, 014a, 014c, 014d, 014f, 015b, 016e, 018d, 019b, 020b, 020c) This accounts for about 20% of the data so I cannot just ignore it.
I do not understand the error code, I have looked at similar problems here, and here but they don't seem to help or I am missing soemthing.
Thanks in advance,
Christopher
Accepted Answer
More Answers (0)
Categories
Find more on Spline Construction in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!