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

조회 수: 3 (최근 30일)
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
Bob Thompson
Bob Thompson 2019년 2월 19일
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 2019년 2월 20일
Thanks Bob, I will try this to see if I could make progress with it. I appreciate your effort.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by