Kelvin functions ker kei functions evaluation
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);
endHi,
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 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 kelvin function, ker/kei MATLAB Answers — New Questions