Cumulative sum function of daily rainfall
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Saleem Sarwar
el 1 de Oct. de 2015
Comentada: Walter Roberson
el 1 de Oct. de 2015
I have a large daily rainfall data and require to create a new series with rainfall of 1, 2 , 3 and 4 day will be same as observed, then day 5 rainfall will be sum of 1, 2,3, 4 and 5 day rainfall. 6 day rainfall will be sum of rainfall of 2, 3, 4, 5 and 6 day rainfall. Repeat this function for 50 years daily rainfall data. Could any body suggest me matlab script for this kind of analysis? data file will be like this
date rainfall Cumulative rainfall
1/1/1950 10 10
1/2/1950 0 0
1/3/1950 0 0
1/4/1950 0 0
1/5/1950 15 25
1/6/1950 5 20
1/7/1950 10 35
1/8/1950 7 42
.........
0 comentarios
Respuesta aceptada
Walter Roberson
el 1 de Oct. de 2015
conv() the rainfall data with one(1,5)
2 comentarios
Saleem Sarwar
el 1 de Oct. de 2015
Editada: Walter Roberson
el 1 de Oct. de 2015
Walter Roberson
el 1 de Oct. de 2015
If you let the rainfall be stored in the column vector r, then
cr = cumsum([0;r]);
col2 = [r(1:4);ss(6:end)-ss(1:end-5)];
[r,col2]
Or
col2 = [r(1:4); conv(r, ones(1,5), 'valid')]; %one step
[r,col2]
Más respuestas (0)
Ver también
Categorías
Más información sobre Random Number Generation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!