How to interpolate data from an excel file
3 views (last 30 days)
Show older comments
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.
1 Comment
Answers (1)
Deepak Sarath
on 17 Apr 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 Comments
Jan
on 17 Apr 2018
Letting an array grow iteratively is inefficient. This is nicer to create x:
x = (1:999) * 0.9765
Deepak Sarath
on 17 Apr 2018
Edited: Deepak Sarath
on 17 Apr 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.
See Also
Categories
Find more on Tables 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!