Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Need to make VPA based function faster

$
0
0
Hello everyone,

I have the following function in which I use the VPA command to get more precision;
the problem i get is that this command is very time consuming, I need to call is hundreds of thousands of times.

Could anyone please tell how to make it faster? Are there any alternative faster solutions?

My Matlab code:

function [out]=schaff(indiv)

 x=indiv.^2;
 
num=sin(vpa(sqrt(sum(x))))^2-0.5;

den=(1+0.001*(sum(x)))^2;
out=double(0.5 +num./den);
 

PS: even sym command is very time consuming.

Thank you in advance

Viewing all articles
Browse latest Browse all 19628

Trending Articles