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 commentaire

Cedric
Cedric le 6 Avr 2013
Modifié(e) : Cedric le 6 Avr 2013
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.

Réponses (0)

Cette question est clôturée.

Produits

Question posée :

le 6 Avr 2013

Clôturé :

le 20 Août 2021

Community Treasure Hunt

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

Start Hunting!

Translated by