How to create a trapezoidal rule routine to evaluate the following Bessel integral without Matlab functions. ME 1101

2 次查看(过去 30 天)

采纳的回答

Christopher Salerno
编辑:Christopher Salerno 2018-12-4
clear all
close all
clc
% Integrates & plots Bessel functions of the first kind
a = 0; % x intial
b = 20; % x final
c = 0; % theta intial
d = pi; % theta final
n = 1; % order of the Bessel integral
int = 100; % intervals for x and theta
theta = linspace(c,d,101);
x = linspace(a,b,101);
for i = 1:length(x)
J_x = (1/pi)*cos(n*theta-x(i)*sin(theta));
J(i) = (d-c)*(sum(J_x)+sum(J_x(2:length(J_x)-1)))/(2*int);
end
plot(x,J)
grid on
grid minor
title('Bessel Function of the First Kind')
xlabel('x')
ylabel('Jn(x)')
% Check with the Bessel function
y = besselj(1,x);
figure
plot(x,y,'b')
grid on
grid minor
title('Bessel Function of the First Kind')
xlabel('x')
ylabel('J_{1}(x)')
figure1.JPG
figure2.JPG

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Bessel functions 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by