Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Code Slows Down if I Preallocate Larger Variables?

1 Ansicht (letzte 30 Tage)
Alessandro
Alessandro am 16 Jun. 2015
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
Hello, I am using Matlab to explicitly integrate equations of motion for a finite element mesh. In the code I initialise all the history variables (such as displacement, velocity and acceleration) to store all the values at every node for every time step.
displace = zeros(gdl,n_inc+1); %
epsilon = zeros(gdl,n_inc+1); %
stress = zeros(gdl,n_inc+1); %
The point is: if I use a larger number of time steps (i.e. a smaller time increment), every single step takes much more to run. Is that avoidable somehow?
  7 Kommentare
Walter Roberson
Walter Roberson am 16 Jun. 2015
32 bit MATLAB or 64 bit MATLAB?
Alessandro
Alessandro am 17 Jun. 2015
64bit version.

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by