How do I add specific columns by interpolation in a time series matrix data?

3 views (last 30 days)
Hello, humble greetings. Please I have a time series data of monthly deformations from January 2005 to December 2015, an 82 by 119 matrix (attached above in .mat format named VC), which in actual fact should have been a matrix of 82 by 132. However, the entire data for some months (columns) are missen, which include, 2011/1, 2011/6, 2012/5, 2012/10, 2013/3, 2013/8, 2013/9, 2014/2, 2014/7, 2014/12, 2015/5, 2015/6, 2015/10, and 2015/11 as seen in the attached time (in .mat format named T2,) for the 82 by 119 matrix. My challange now is how to add data for each of these missen months by interpolation at their respective columns. each column reprsents data for a month (example, first column is for january 2005, second column is for february 2005 in that order to December 2015). I would appreciate your guide and help.
Thank you.
  4 Comments
Bob Thompson
Bob Thompson on 19 Feb 2019
The slow way is to run a double loop, one for each row, and one for each column. You might be able to get rid of one of those by having an array as an input for the desired values, but I don't know if you can get rid of both and put it all in one command.
for i = 1:size(data,1)
tmp = interp1(data(1,:),data(i,:),missingtimes);
data2(i,:) = [data(i,:),tmp];
end
Things are a bit out of order, but you can probably sort them easily enough.
Abubakar Sani-Mohammed
Abubakar Sani-Mohammed on 20 Feb 2019
Thanks Bob, I will try this to see if I could make progress with it. I appreciate your effort.

Sign in to comment.

Answers (0)

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!