Reducing the time for MATLAB code
Reducing the time for MATLAB code
(OP)
Hello, I am working on a code on MATLAB 7.0. It takes me about 5 hours for my program to run once.
I am working on optimization, so I have some functions that are called thousands of times.
I read about vectorizing the code, but im dealing with sophisticated loops and im not sure if they can be vectorized.
I also tried to run the profiler, and I analyzed the function taking most of the time.
For example, it says 35 secs for "other lines and overhead" and i was wondering if i can do something to reduce this time.
Other lines in my function dont take much time relative to the 35 secs mentioned above.
I can post the results obtained in the profiler if it helps.
Thank you for any help.
I am working on optimization, so I have some functions that are called thousands of times.
I read about vectorizing the code, but im dealing with sophisticated loops and im not sure if they can be vectorized.
I also tried to run the profiler, and I analyzed the function taking most of the time.
For example, it says 35 secs for "other lines and overhead" and i was wondering if i can do something to reduce this time.
Other lines in my function dont take much time relative to the 35 secs mentioned above.
I can post the results obtained in the profiler if it helps.
Thank you for any help.





RE: Reducing the time for MATLAB code
Is there a disconnect here?
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: Reducing the time for MATLAB code
Thanks for your reply.
35 secs for running the function once.
The code runs 200 times in order to perform optimization, and each time it runs the function itself gets called more than once. So 35 secs which initially seems a very small time becomes 35secs x 200 x no. of calls per 1 loop.
Thanks.
RE: Reducing the time for MATLAB code
It sounds like you're running your own solver loop, which is usually going to be pathetic in performance compared to built-in functions.
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: Reducing the time for MATLAB code
Yes, the functions Im using arent built-in. What I wanted to know is whether the time taken for "other lines and overhead" can be reduced or no. I dont even know what overhead is. It is taking %87 of the function time.
Thanks.
RE: Reducing the time for MATLAB code
One possibility is to compile the code; that might make it somewhat faster.
TTFN
FAQ731-376: Eng-Tips.com Forum Policies