フィルターのクリア

One dimensional interpolation of a two dimensional matrix

2 ビュー (過去 30 日間)
Mohammed Yousuf
Mohammed Yousuf 2021 年 3 月 7 日
コメント済み: Mohammed Yousuf 2021 年 3 月 7 日
I have a matrix of 24x365, i want to increase it to 1440x365 by interpolating 59 values in between every two values rowwise. because i have a hourly data of one year. (24 hours) 365 (days). I need minute wise data so one point has to become 60 points..
  2 件のコメント
Stephen23
Stephen23 2021 年 3 月 7 日
編集済み: Stephen23 2021 年 3 月 7 日
The expected output size does not match your explanation. If you add 59 values between any two existing adjacent values (exactly as your state), then you will actually get an output matrix with
23*60+1 % rows
ans = 1381
not
24*60 % rows (incorrect)
ans = 1440
This is probably because you have not considered the ends (e.g. requiring extrapolation before/after the existing values).
"I need minute wise data so one point has to become 60 points."
Have you considered what happens at the edges of your data?
Here is a simple demonstration of your explanation and the corresponding output matrix size. Here is a 1x4 vector:
X = [0, 3, 6, 9];
Now lets add two points between adjacent existing values, exactly as you specify:
Y = [0,1,2,3,4,5,6,7,8,9];
The output vector actually has
N = numel(X); % number of existing points
P = 2; % number of points added
(N-1)*(P+1)+1 % number of output points
ans = 10
Lets check this value against your estimation:
numel(Y)
ans = 10
N*(P+1) % your approach
ans = 12
Mohammed Yousuf
Mohammed Yousuf 2021 年 3 月 7 日
Your explanation is appreciated and thanks for it. Now I understood.
Thank you very much

サインインしてコメントする。

採用された回答

KSSV
KSSV 2021 年 3 月 7 日
Let A be your 24*365 data matrix.
t = (60:60:24*60)' ;
ti = (1:1:24*60)' ;
B = zeros(1440,365) ;
for i = 1:365
B(:,i) = interp1(t,A(:,i),ti) ;
end
  3 件のコメント
KSSV
KSSV 2021 年 3 月 7 日
Either the first sixty or last sixty have to be extrapolated....we cannot gurantee that value.
Mohammed Yousuf
Mohammed Yousuf 2021 年 3 月 7 日
Thanks for the answer
I got it

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by