False result why applying interp1 function!

Hi to all,
I have data taken at non-regular intervals, and I'd like to interpolate the data to have values every 100ms.
if
17:43:08.437 > ATT_HandleValueNotification: status=0 h=45 n=3 07 C7 17
17:43:08.477 > ATT_HandleValueNotification: status=0 h=45 n=3 07 C7 17
17:43:08.497 > ATT_HandleValueNotification: status=0 h=45 n=3 07 C7 17
17:43:08.516 > ATT_HandleValueNotification: status=0 h=45 n=3 07 C7 17
17:43:08.537 > ATT_HandleValueNotification: status=0 h=45 n=3 09 C7 17
17:43:08.577 > ATT_HandleValueNotification: status=0 h=45 n=3 07 C7 17
end
My code is :
if s=data(:,3)+data(:,4)/1000; % convert to seconds+fractions
t = datenum(2014,07,18,data(:,1),data(:,2),s)*86400;
t = t - t(1);
sample = interp1(t,res(:,1:3), 0:0.01:t(end)); % i fixed a time to 100ms to obtain estimated data in this time
// end
Thanks in advance
end

5 Comments

This is not clear, what are your data? cell array? sting?
Thanks for your reply.
My data is cell array , My table res is like this:(3 columns) contains 380 rows
if
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,140625000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
end
The problem here that when i appliy interp1 function , it gives me a table with 4230 rows!!!
the cyclist
the cyclist on 18 Jul 2014
Edited: the cyclist on 18 Jul 2014
@inti,
By far the best thing you can do to help us solve your problem is to give us a small piece of functioning MATLAB code (including the part that defines the data) that illustrates the problem. Otherwise, we spend far too much time guessing.
Thanks for your reply.
I have irregular time series data: (time (h:m:s:ms), X-acceleration, Y-acceleration, Z-acceleration)in hexadecimal
Portion of my log file
if 17:43:08.437 > ATT_HandleValueNotification: status=0 h=45 n=3 07 C7 17
17:43:08.477 > ATT_HandleValueNotification: status=0 h=45 n=3 07 C7 17
17:43:08.497 > ATT_HandleValueNotification: status=0 h=45 n=3 07 C7 17
17:43:08.516 > ATT_HandleValueNotification: status=0 h=45 n=3 07 C7 17
17:43:08.537 > ATT_HandleValueNotification: status=0 h=45 n=3 09 C7 17
end
The first column is for a Time and the three last columns are for acceleration's data (x,y,z).
My goal here is to interpolate irregular Time series to regular time series and i like to obtain acceleration's data every 0.01 seconds.
After converting acceleration's data from hexadecimal to acceleration's g , i obtain this table
if 0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,140625000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
end
And this a portion of a table sample after applying interp1 function :
if
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
0,110866306584362 -0,890625000000000 0,359375000000000
0,125746056832695 -0,890625000000000 0,359375000000000
0,140624576267240 -0,890625000000000 0,359375000000000
0,132812426778048 -0,890625000000000 0,359375000000000
0,125000277288855 -0,890625000000000 0,359375000000000
0,117188127799663 -0,890625000000000 0,359375000000000
0,109375978310470 -0,890625000000000 0,359375000000000
0,109375000000000 -0,890625000000000 0,359375000000000
end
i think that i have a duplicate values

Answers (0)

This question is closed.

Tags

Asked:

on 18 Jul 2014

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!