Converting wind/wave data to hourly data by interpolation
4 ビュー (過去 30 日間)
古いコメントを表示
Dear All,
I have wind and wave data that as can be seen attached. I want to convert it to hourly data acording to duration (time) values in column A. The value of duration here represents the duration of the wind blowing and its unit is hour. I want to interpolate all the other parameters while converting to hourly data. For example, I have formulated this in Excel for the line as follows,
D2-(($D$2-$D$3)/$A$2)
D3-(($D$2-$D$3)/$A$2)
D4-(($D$2-$D$3)/$A$2)
......
D8-(($D$2-$D$3)/$A$2)
The problem is, this is a very large set of data and doing this manually in Excel will take an enourmous amount of time. Is there a command in MATLAB where I can add (A-1) number of columns to each line and interpolate the rest of columns as described above?
Thank you in advance!
5 件のコメント
Adam Danz
2022 年 6 月 30 日
Look at the last row of data; it may not be included in the final interpolated timetable. I don't know how you would interpolate that last row but it's just something to keep in mind.
採用された回答
Adam Danz
2022 年 6 月 30 日
編集済み: Adam Danz
2022 年 6 月 30 日
If the durations are consecutive, then I suggest creating an time stamps based on the durations which allows you to use retime to interpolate the timetable to hourly samples.
I've created a "clean" version of your file by removing the rows that were highlighted.
T = readtable('sample_data_clean.xlsx')
% Create time stamps with arbitrary starting date/time
% Note that the time stamps start at hour 0.
arbitraryDateTime = datetime(2000,1,1,0,0,0) + [0;cumsum(hours(T.Duration(1:end-1)))];;
TT = table2timetable(T,'RowTimes',arbitraryDateTime)
% Interpolate to hourly samples
TThourly = retime(TT,'hourly','linear')
Convince yourself that the results are reasonable by plotting the original and interp'd data
figure
plot(TT.Time, TT.WindDirection_degree_,'-b','linewidth',2,'displayname','original');
hold on
plot(TThourly.Time, TThourly.WindDirection_degree_,'-r','displayname','interp''d');
legend
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Calendar についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!