Kelvin functions ker kei functions evaluation

5 visualizaciones (últimos 30 días)
Carola Forlini
Carola Forlini el 14 de Mayo de 2024
Editada: Torsten el 14 de Mayo de 2024
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

Respuestas (1)

Torsten
Torsten el 14 de Mayo de 2024
Editada: Torsten el 14 de Mayo de 2024
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")
ans = 
limit(imag(besselk(0,x)),x,0,"right")
ans = 
0
imag(besselk(0,0))
ans = 0
The value ker(0) = + Inf agrees with MATHEMATICA:

Community Treasure Hunt

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

Start Hunting!

Translated by