How to interpolate data from an excel file

I have an excel file with data collected from 8 runs of 1000 time points each. I want to interpolate the data to get 1024 data points for each of the 8 runs. I have attached a sample excel file as well as a script a colleague suggested we use but is still incomplete.

Answers (1)

Hi Alex, At first you need to specify the time doamin or query points to which you want to extrapolate . So let me assume from your question, you jus wanna convert 1000 samples to 1024 samples irrespective of time stamps. So.

   %read the time column in excel to variable 'time'
   %read the Values column in excel to variable 'Data'
   y=0;
   x=0;
   for i =1 :999
        y=y+0.9765; % 1000/1024
        x=[x;y];
   end
   %so now you have the time instances at which you wanna extrapolate the data.
   output=interp1(time,Data,x,'linear','extrap');

2 Comments

Letting an array grow iteratively is inefficient. This is nicer to create x:
x = (1:999) * 0.9765
Hey Jan, This will create an array of length 999 not 1024. Probably ,
x= (1:1024)*.9765
Will do, Thanks for your piece of logic.

Sign in to comment.

Categories

Asked:

on 17 Apr 2018

Edited:

on 17 Apr 2018

Community Treasure Hunt

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

Start Hunting!