[K,E] =
ellipke(M,tol) computes
the complete elliptic integral to accuracy tol.
The default value of tol is eps.
Increase tol for a less accurate but more quickly
computed answer.

Plot the complete elliptic integrals of the first and second kind for the allowed range of M.

M = 0:0.01:1;
[K,E] = ellipke(M);
plot(M,K,M,E)
grid on
xlabel('M')
title('Complete Elliptic Integrals of First and Second Kind')
legend('First kind','Second kind')

Faster Calculations of the Complete Elliptic Integrals by Changing the Tolerance

The default value of tol is eps. Find the runtime with the default value for arbitrary M using tic and toc. Increase tol by a factor of thousand and find the runtime. Compare the runtimes.

tic
ellipke(0.904561)

ans = 2.6001

toc

Elapsed time is 0.040122 seconds.

tic
ellipke(0.904561,eps*1000)

ans = 2.6001

toc

Elapsed time is 0.012280 seconds.

ellipke runs significantly faster when tolerance is significantly increased.

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.