MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayNew to MATLAB?
MATLAB Central > MATLAB Newsreader > Can this run any faster? 

Hi all, 
"Elnaz " <ebsadeghian@gmail.com> wrote in message <kk24q4$3j5$1@newscl01ah.mathworks.com>... 

On 4/9/2013 11:46 PM, Roger Stafford wrote: 
dpb <none@non.net> wrote in message <kk418i$anr$1@speranza.aioe.org>... 
"Steven_Lord" <slord@mathworks.com> wrote in message <kk3vel$g4b$1@newscl01ah.mathworks.com>... 
Thanks Roger; that is a clever substitute. It runs 0.01 second faster than the original one. 
I meant 0.02 sec in total in one function calling. 0.01 sec for the first loop and 0.01 sec for the second one. I call that function thousands of times in my scriprt so it is indeed effective but unfortunately not enough. My simulations are still very long. 
IMO, the only way to speed up significantly is to program this piece of code in MEX, assuming you own a decent C/fortran compiler. 
Bruno, 
"Elnaz " <ebsadeghian@gmail.com> wrote in message <kk4hfs$g2v$1@newscl01ah.mathworks.com>... 
"Elnaz " <ebsadeghian@gmail.com> wrote in message <kk4hfs$g2v$1@newscl01ah.mathworks.com>... 
Few more ideas, starting from Roger's code: 
Here is a mex file, about three time faster on my PC. 
Subject: Can this run any faster? From: Heinrich Acker Date: 11 Apr, 2013 09:11:13 Message: 15 of 37 
"Elnaz " <ebsadeghian@gmail.com> wrote in message <kk24q4$3j5$1@newscl01ah.mathworks.com>... 
I have optimized the MEX code: 
"Heinrich Acker" wrote in message <kk5unh$gc1$1@newscl01ah.mathworks.com>... 
"Yair Altman" wrote in message <kk6gdl$8jp$1@newscl01ah.mathworks.com>... 
"Eric Sampson" wrote in message <kk6qln$c62$1@newscl01ah.mathworks.com>... 


Slighly faster (about 4 times than MATLAB code) 
"Steven_Lord" <slord@mathworks.com> wrote in message <kk71ae$4d3$1@newscl01ah.mathworks.com>... 
Subject: Can this run any faster? From: Roger Stafford Date: 12 Apr, 2013 19:04:07 Message: 24 of 37 
"Elnaz " <ebsadeghian@gmail.com> wrote in message <kk24q4$3j5$1@newscl01ah.mathworks.com>... 
I see your point Roger. It's very clever. 
Subject: Can this run any faster? From: Roger Stafford Date: 13 Apr, 2013 00:10:14 Message: 26 of 37 
"Roger Stafford" wrote in message <kk9lr7$782$1@newscl01ah.mathworks.com>... 
I test Roger's exponential transformation, and the loop simplifies greatly. 
Sorry I make a wrong assumption in the normalization. Here is the correct one: 
I also observed now and then a difference in the result that might indicate overflowing in exponential methods, despite the normalization by column suggested by Roger. 
I have removed unnecessary statements in Roger's exponetional MEX. 
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <kkb9ko$p4s$1@newscl01ah.mathworks.com>... 
Subject: Can this run any faster? From: Roger Stafford Date: 14 Apr, 2013 05:48:07 Message: 32 of 37 
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <kkbk8a$m33$1@newscl01ah.mathworks.com>... 
"Roger Stafford" wrote in message <kkdfun$op2$1@newscl01ah.mathworks.com>... 
Hi all, 
"Elnaz " <ebsadeghian@gmail.com> wrote in message <kmelul$5ku$1@newscl01ah.mathworks.com>... 
"Elnaz " <ebsadeghian@gmail.com> wrote in message <kmelul$5ku$1@newscl01ah.mathworks.com>... 
Bruno, 
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.