필터 지우기
필터 지우기

Plot interations of Monte-Carlo simulation

조회 수: 15 (최근 30일)
antifreund
antifreund 2020년 7월 8일
편집: antifreund 2020년 7월 8일
Hi there,
I ran a Monte Carlo simulation and stored all each iteration in a cell of an array called MATRIX
matrix{iteration,1}
Plotting all iterations in separate graphs is straightforward:
for i=1:length(matrix)
figure(i)
spy(matrix{iteration,1},'r*')
end
BUT running 100 iterations or more, that doesnt seem feasible.
Or what I am doing right now is plotting the last iteration via the spy function:
spy(matrix{end,1},'r*')
Nice, but not quite what I would like.
I have two options in my mind:
  1. run the 100 iterations in one plot successively with a 1 sec delay
  2. make a gif with the 100 iterations
Any ideas? I am sure this is again just a few lines of code that I am not able to figure out. Thanks in advance for your help. Much appreciated!!!

채택된 답변

antifreund
antifreund 2020년 7월 8일
편집: antifreund 2020년 7월 8일
Actually I just found something that works for me.
The function used is called 'imwrite'. Please find more details in the link below:
This is how the final results looks like. :-)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by