Splitting Data Into Intervals and Finding the cumulative value

2 ビュー (過去 30 日間)
Queena Edwards
Queena Edwards 2022 年 3 月 13 日
コメント済み: Star Strider 2022 年 3 月 15 日
a =
1.0000 71.8700
2.0000 136.1100
3.0000 151.3500
4.0000 139.1300
5.0000 127.1900
6.0000 70.5400
7.0000 76.8900
8.0000 113.1700
9.0000 52.8000
10.0000 29.6300
11.0000 82.2000
12.0000 99.7300
13.0000 46.6200
14.0000 78.9300
15.0000 68.8000
16.0000 35.7400
17.0000 83.0200
18.0000 105.4000
19.0000 15.7200
20.0000 13.6600
21.0000 48.9600
22.0000 43.8700
23.0000 6.8100
24.0000 39.3100
25.0000 22.5900
27.0000 77.1500
29.0000 45.1900
30.0000 17.2500
34.0000 138.4000
38.0000 86.2800
I have the vector "a", Column 1 is the duration (hours) Column 2 is the rainfall amount (mm) and i would like to the following processes:
1) This is to be applied for a duration of more than 6 hours
2) Divided the rainfall into equal amounts depending on the duration. eg) for the 6 hour duration, 70.54/6 = 11.76 and so on for the others
3) Find the cumulative curve and plot. eg) looking at the same 6 hour duration
Hour Rainfall Amount
1 11.76
2 23.52
3 35.08
4 46.84
5 58.6
6 70.36
I'm not sure if you would use a loop but in total there would be 24 curves developed

採用された回答

Star Strider
Star Strider 2022 年 3 月 14 日
Try this —
a = [1.0000 71.8700
2.0000 136.1100
3.0000 151.3500
4.0000 139.1300
5.0000 127.1900
6.0000 70.5400
7.0000 76.8900
8.0000 113.1700
9.0000 52.8000
10.0000 29.6300
11.0000 82.2000
12.0000 99.7300
13.0000 46.6200
14.0000 78.9300
15.0000 68.8000
16.0000 35.7400
17.0000 83.0200
18.0000 105.4000
19.0000 15.7200
20.0000 13.6600
21.0000 48.9600
22.0000 43.8700
23.0000 6.8100
24.0000 39.3100
25.0000 22.5900
27.0000 77.1500
29.0000 45.1900
30.0000 17.2500
34.0000 138.4000
38.0000 86.2800];
a2 = a(7:end,:); % Limit 'a'
NrSP = size(a2,1); % Number Of Subplots
r = floor(sqrt(NrSP)); % Subplot Rows
c = ceil(NrSP/r); % Subplot Columns
figure
for k = 1:NrSP
subplot(r,c,k)
xv{k} = 1:a2(k,1);
yv{k} = xv{k}*a2(k,2)/a2(k,1);
plot(xv{k}, yv{k},'.-')
grid
xlim([0 a2(end,1)]) % Same 'XLim' For All Plots
ylim([0 max(a2(:,2))]) % Same 'YLim' For All Plots
title(sprintf('a(%d,:)',k+6))
end
.
  6 件のコメント
Queena Edwards
Queena Edwards 2022 年 3 月 15 日
Thank you for your help
Star Strider
Star Strider 2022 年 3 月 15 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by