Splitting Data Into Intervals and Finding the cumulative value
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Queena Edwards
am 13 Mär. 2022
Kommentiert: Star Strider
am 15 Mär. 2022
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
0 Kommentare
Akzeptierte Antwort
Star Strider
am 14 Mär. 2022
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Scatter Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!