The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Speedup this function
Replies: 1   Last Post: Jan 21, 2013 1:46 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Francesco Perrone

Posts: 39
Registered: 5/2/12
Re: Speedup this function
Posted: Jan 21, 2013 1:46 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Currently I'm running the following alternative version of the above function:

function beta = beta_calc(k,c,gamma)
k_1d = reshape(k,[1,numel(k)]);
E_1d =@(k) 1.453.*k.^4./((1 + k.^2).^(17/6));
E_int = arrayfun(@(i) integral(E_1d,k_1d(i),Inf),1:numel(k_1d));
beta_1d = c*gamma./(k_1d.*sqrt(E_int));
beta = reshape(beta_1d,[size(k,1),size(k,2)]);

which is just slightly better performing than the previous case.

I'd like to find a way to strongly reduce the computation consumption.

I thank you for any hunch.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.