Iterations are taking too long
이전 댓글 표시
Hi,
My coding is taking too long to solve and I think that I have a lot of improvements which I can make. I am also a beginner in MATLAB and thus I require some help.
Basically I have a code that solves the motion of 3 DOF system. Similar to a mass on a spring. I have two for loops where one iterates for the force and the other iterates for the time response. I am solving the time response using the Newmark integration scheme. Now after that all iterations are done, the code requires that the results are written to an excel sheet for the three degrees of freedom together with plotting of graphs of the corresponding displacements.
I am using xlswrite for each degree of freedom meaning I have 3 xlswrite commands.
Are there any suggestions on how I can improve my computational time?
Thanks!
댓글 수: 3
José-Luis
2014년 6월 24일
Lots of people might be able to help you if you show your code. Otherwise, we are limited to guessing.
One could just say: "Try a faster computer", for example.
Sara
2014년 6월 24일
Use the profiler and find the bottleneck
Adam
2014년 6월 24일
Using the Matlab profiler would be a good start point.
In its simplest form you can just put
profile on
...Your code...
profile off
profile viewer
to give you a run down of where in your code the time is being spent.
Then, in response to that there are many things you can possibly do, but until you find out where the time is actually being spent you may spend time optimising a piece of code that is only taking 0.1% of the total time.
채택된 답변
추가 답변 (2개)
Marisa Micallef
2014년 6월 25일
Marisa Micallef
2014년 6월 25일
0 개 추천
댓글 수: 1
Titus Edelhofer
2014년 6월 26일
Hi,
U(i,j) means reading (or assigning) a single entry in the matrix at row i and column j. U(i,:) means reading (or assigning) a vector, namely the i-th row.
Titus
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!