Generate periodic moving average lag 1 autoregressive model

7 visualizaciones (últimos 30 días)
Mahmoud Zemzami
Mahmoud Zemzami el 4 de Dic. de 2024
Respondida: Drishti el 12 de Mzo. de 2025
Hi Matlab community,
I am working on a river basin simulation model for a reservoir (dam) to test it under different conditions.
The observed data of streamflow that fed the reservoir are short (less than 30 years of monthly data. I want to creat 50,000 years of stochastically generated monthly streamflow to the reservoir system.
Can you help to model my streamflow with a periodic moving average lag 1 autoregressive model, to generate 50,000 years of monthly data.
Many thanks.

Respuestas (1)

Drishti
Drishti el 12 de Mzo. de 2025
To generate 50,000 years of monthly streamflow data with a periodic moving average lag 1 autoregressive model in MATLAB, you can utilize a custom method which takes into consideration the periodicity of the available data.
You can refer to the below given code snippet to get better understanding:
% Generate synthetic data
for year = 1:nYears
for month = 1:12
idx = (year-1)*12 + month;
if year == 1
% For the first year, initialize using observed data or available data
generatedStreamflow(idx) = observedStreamflow(month);
else
% Generate using AR(1) model
prevValue = generatedStreamflow(idx - 12);
noise = residuals{month}(randi(length(residuals{month})));
generatedStreamflow(idx) = monthlyMeans(month) + ...
phi(month) * (prevValue - monthlyMeans(month)) + noise;
end
end
end
In the provided code, for the years that come after the first one, the autoregressive model is used to create new data points. Further, the 'prevValue' variable stores the value from the same month in the previous year.
In addition, you can modify the parameters as per the requirement.
I hope this helps in getting started.
Thank you

Categorías

Más información sobre Conditional Mean Models en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by