フィルターのクリア

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 Center および File ExchangeConversion 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