Efficient memory allocation for MonteCarlo simulation

2 次查看(过去 30 天)
Hi, I am a beginner with Matlab and have an issue, maybe someone can help I need to perdorm a MC simulation, I have data for 8760 hours (1 year), i need to create a normal distribution for a variable Vf, and run the code at least 10000 times,
The code is like
n=10000;
L=length(data_es1);
for i=1:1:n
%L is 8760, data_es1(j,2) is the mean while data_es1(j,12) is st.deviation
for j=1:1:L
Vf(j,i)=data_es1(j,2)+data_es1(j,12).*randn;
end
This would create a 10000x8760 matrix, that is very big, and I have several variables to manage in this way (Vf plus at least 5 others), I have encourred a "out of memory" problem,
Any idea to run the code smarter and save memory/busy problems?
Thank you
Alex
  6 个评论
Alessandro Cerrano
Alessandro Cerrano 2017-10-20
Yes, the code proposed was faster but I had still the mempry problem... I Will try to calculate only the necesary variables. Thanks again

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by