How can i speed up this part of my code?
Show older comments
I have this part of code that i apply for different indns (which are different vectors each time):
phi1=phi(indn1);
p1=p(indn1,indn1);
rtn1=(phi1'*(p1*phi1));
Ctn1=((rtn1*ep2)/(st*(1+rtn1)));
Ctn1=max(Ctn1,0);
Sn1=gammainc(Ctn1*0.5,0.5) ;
Sn1=1-Sn1;
phi2=phi(indn2);
....
....
I tried cellfun and structfun but it was slower. Is there something more i can do to improve the speed?
5 Comments
EDITED on 04.19
Have you used the profiler to see what is slow? If not, type
profile viewer
and call your script from there to get a report.
Just one point, ep2 and st are scalars (?)
amanita
on 19 Apr 2013
Cedric
on 19 Apr 2013
It seems to me that it would be difficult to improve the efficiency of this part of the code and that the approach would have to be changed at a larger scale to improve the efficiency (if it is even possible). I write this comment to bump up your thread and someone else might see it and have some idea.
amanita
on 19 Apr 2013
amanita
on 16 Jun 2013
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements 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!