How to interpolate data from an excel file

4 visualizaciones (últimos 30 días)
Alex Hentschel
Alex Hentschel el 17 de Abr. de 2018
Editada: Deepak Sarath el 17 de Abr. de 2018
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.

Respuestas (1)

Deepak Sarath
Deepak Sarath el 17 de Abr. de 2018

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 comentarios
Jan
Jan el 17 de Abr. de 2018
Letting an array grow iteratively is inefficient. This is nicer to create x:
x = (1:999) * 0.9765
Deepak Sarath
Deepak Sarath el 17 de Abr. de 2018
Editada: Deepak Sarath el 17 de Abr. de 2018
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Tables en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by