Generate periodic moving average lag 1 autoregressive model
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuestas (1)
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
0 comentarios
Ver también
Categorías
Más información sobre Conditional Mean Models 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!