필터 지우기
필터 지우기

Kelvin functions ker kei functions evaluation

조회 수: 4 (최근 30일)
Carola Forlini
Carola Forlini 2024년 5월 14일
편집: Torsten 2024년 5월 14일
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

답변 (1개)

Torsten
Torsten 2024년 5월 14일
편집: Torsten 2024년 5월 14일
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:

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by