Simulation in Matlab running too slow
Show older comments
My simulation in matlab is running too slow because it is asking me to preallocate. The problem is that I do not know the dimension of the matrix because I do not know how many iterations will require (and requires a lot). What can I do? Also, if someone knows how to keep instead of whole matrix only the last two values and updating in each iteration, due to I am using double integrator in my loop. Thanks!
7 Comments
per isakson
on 4 Aug 2018
Walter Roberson
on 4 Aug 2018
How does this question differ from https://www.mathworks.com/matlabcentral/answers/413431-matlab-is-running-too-slow#comment_596397 ?
Alba Cuevas
on 4 Aug 2018
KALYAN ACHARJYA
on 4 Aug 2018
Do not post the multiple questions, if your question having sufficient information and relevant, definitely you will get the answer.
Now the question part, remove the loops by using other alternatives method.
Alba Cuevas
on 4 Aug 2018
Walter Roberson
on 5 Aug 2018
I see the other question is gone now. But if I recall correctly, the original version had code for us to look at. When there is no code for us to look at, we can only reply in generalities, such as per's reference to Non-deterministic pre-allocation.
Alba Cuevas
on 5 Aug 2018
Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!