Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Code Slows Down if I Preallocate Larger Variables?

조회 수: 1 (최근 30일)
Alessandro
Alessandro 2015년 6월 16일
마감: MATLAB Answer Bot 2021년 8월 20일
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
Walter Roberson
Walter Roberson 2015년 6월 16일
32 bit MATLAB or 64 bit MATLAB?
Alessandro
Alessandro 2015년 6월 17일
64bit version.

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by