My code takes so long to execute

My code works fine until it gets to this block. This loop takes too long to execute. Is there any way to solve this problem?
if ~exist('nworkers','var'), nworkers = 0; end % default nworkers to zero
r1 = rad(1);
parfor (i = 1 : numel( kru ), nworkers)
jlu(:,i) = sbesselj ( lkr, kru(i) );
djlu(:,i) = dsbesselj ( l, kru(i) );
if ru(i) > r1
hlu(:,i) = sbesselh ( lkr, kru(i) );
dhlu(:,i) = dsbesselh ( l, kru(i) );
end
end

2 件のコメント

per isakson
per isakson 2021 年 2 月 3 日
Did you use Preallocation for jlu, djlu, hlu, etc.?
Image Analyst
Image Analyst 2021 年 2 月 5 日
How long is "long"?

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeBessel functions についてさらに検索

製品

リリース

R2018a

質問済み:

2021 年 2 月 3 日

コメント済み:

2021 年 2 月 5 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by