How to accelerate exponent (exp) calculation in MATLAB?
Show older comments
Hello everyone. I developed a program and I find it spends lots of time on calculating exp(-ax). So is there any way to accelerate such calculations exp(-ax)? Many thanks~
4 Comments
KSSV
on 21 Apr 2017
It depends on how you have coded....we can help you only on knowing how your code is.
Walter Roberson
on 21 Apr 2017
Are you doing a symbolic calculation?
Tian
on 21 Apr 2017
Walter Roberson
on 21 Apr 2017
ZZZ = rand(1,1E6);
timeit(@() exp(ZZZ),0)
This is about 0.0045 seconds, so even 10^8 exp() would take less than 1/2 second.
Accepted Answer
More Answers (1)
Rangeet Mitra
on 10 Nov 2018
0 votes
Try replacing exp() by a custom function using a Hermite approximation for exp() (which is learnt a-priori for the dynamic range of your code). Without loss of performance, you will get a considerable speedup!!!
Categories
Find more on 循环及条件语句 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!