# MATLAB bessel function

Graphical representations of Bessel functions resemble those of sine or cosine functions, but decay as if they were sine or cosine functions divided by a term of the form √x.

In this tutorial we will see how to make the MATLAB bessel function. The article will be organized as follows:

## What are Bessel functions?

There are two kinds of Bessel functions:

• the Bessel functions of the first kind, Jn, solutions of the above differential equation which are defined at 0;
• the Bessel functions of the second kind, Yn, solutions which are not defined at 0 (but which have an infinite limit at 0).

Graphical representations of Bessel functions resemble those of sine or cosine functions, but decay as if they were sine or cosine functions divided by a term of the form √x.

## Represent in MATLAB bessel function

For the Bessel functions of the first kind, the code can be :

```z = 0:0.1:20;
J = zeros(5,201);
for i = 0:10
J(i+1,:) = besselj(i,z);
end
plot(z,J)
```

For the the Bessel functions of the second kind, it can be just an adaptation of the code by replacing besselj by bessely :

```z = 0:0.1:20;
J = zeros(5,201);
for i = 0:4
J(i+1,:) = bessely(i,z);
end
plot(z,J)
axis([-0.1 20.2 -2 0.6])```

It will give you the result :