# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

# besselk

Modified Bessel function of second kind

## Syntax

`K = besselk(nu,Z)K = besselk(nu,Z,1)`

## Description

`K = besselk(nu,Z)` computes the modified Bessel function of the second kind, Kν(z), for each element of the array `Z`. The order `nu` need not be an integer, but must be real. The argument `Z` can be complex. The result is real where `Z` is positive.

If `nu` and `Z` are arrays of the same size, the result is also that size. If either input is a scalar, it is expanded to the other input's size.

`K = besselk(nu,Z,1)` computes `besselk(nu,Z).*exp(Z)`.

## Examples

collapse all

Create a column vector of domain values.

```z = (0:0.2:1)'; ```

Calculate the function values using `besselk` with `nu = 1`.

```format long besselk(1,z) ```
```ans = Inf 4.775972543220472 2.184354424732687 1.302834939763502 0.861781634472180 0.601907230197235 ```

Define the domain.

```X = 0:0.01:5; ```

Calculate the first five modified Bessel functions of the second kind.

```K = zeros(5,501); for i = 0:4 K(i+1,:) = besselk(i,X); end ```

Plot the results.

```plot(X,K,'LineWidth',1.5) axis([0 5 0 8]) grid on legend('K_0','K_1','K_2','K_3','K_4','Location','Best') title('Modified Bessel Functions of the Second Kind for v = 0,1,2,3,4') xlabel('X') ylabel('K_v(X)') ```

collapse all

### Bessel's Equation

The differential equation

`${z}^{2}\frac{{d}^{2}y}{d{z}^{2}}+z\frac{dy}{dz}-\left({z}^{2}+{\nu }^{2}\right)y=0,$`

where ν is a real constant, is called the modified Bessel's equation, and its solutions are known as modified Bessel functions.

A solution Kν(z) of the second kind can be expressed as:

`${K}_{\nu }\left(z\right)=\left(\frac{\pi }{2}\right)\frac{{I}_{-\nu }\left(z\right)-{I}_{\nu }\left(z\right)}{\mathrm{sin}\left(\nu \pi \right)},$`

where Iν(z) and Iν(z) form a fundamental set of solutions of the modified Bessel's equation,

`${I}_{\nu }\left(z\right)={\left(\frac{z}{2}\right)}^{\nu }\sum _{k=0}^{\infty }\frac{{\left(\frac{{z}^{2}}{4}\right)}^{k}}{k!\Gamma \left(\nu +k+1\right)}$`

and Γ(a) is the gamma function. Kν(z) is independent of Iν(z).

Iν(z) can be computed using `besseli`.

### Tall Array Support

This function fully supports tall arrays. For more information, see Tall Arrays.

Watch now