ans =
Kelvin functions ker kei functions evaluation
Show older comments
Hi,
I am working with Kelvin functions and in the specific with ker(x) and kei(x). I build a short function to evaluate them using the Matlab build in besselk function but when I test it I am not obtaining the expected results.
The values should be:
kei(0)=-0.78540; ker(0)=-inf
Instead I get kei(0)=0
Can anyone help?
Thank you.
% Define a range of x values
x = linspace(0, 6, 100);
% Calculate ber and bei
[ker_vals, kei_vals] = kelvink(0, x);
% Plot the results
figure;
plot(x, ker_vals, 'b-', x, kei_vals, 'r--');
title('Kelvin KER and KEI Functions');
xlabel('x');
ylabel('Function Value');
legend('ker(x)', 'kei(x)');
function [ker, kei] = kelvink(n, x)
a = exp(pi*1i/4);
ke = besselk(n,a*x);
ker = real(ke);
kei = imag(ke);
end
Answers (1)
The value kei(0) = -pi/4 only exists in the limit :
syms x
a = exp(pi*1i/4);
limit(imag(besselk(0,a*x)),x,0,"right")
limit(imag(besselk(0,x)),x,0,"right")
imag(besselk(0,0))
The value ker(0) = + Inf agrees with MATHEMATICA:
Categories
Find more on Data Type Identification 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!