Need ideas on how to optimize this code.

my two files are located in the same paste:
optimal starting values are:
rows=100
cols=100
days=100
daysimmune=5
p=.4
in=2
axes1 and axes2 are figure/subplot handles
anything higher and the graphing slows down, with these settings you can see an example of a virus spreading through a population of rows*cols (edges ommited, they always remain at value 0 for simplification)
Looking for anyway possible to optimize these processor heavy loops, without screwing anything up, thanks for any help in advance!

1 个评论

Did you profile this code? If not, execute the following in the command window, after having defined all input parameters of sim_virus:
profile viewer
Then type the call in the field on the right of Run this code:
sim_virus(rows,cols,days,daysimmune,p,in,axes1,axes2)
and click on [Start profiling]. You will have the full profile of your function, which show what part(s) to work on in priority.

回答(0 个)

此问题已关闭。

产品

提问:

2013-4-6

关闭:

2021-8-20

Community Treasure Hunt

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

Start Hunting!

Translated by