Friday, July 24, 2009

base2dec

Base to decimal number conversion

Syntax

  • d = base2dec('strn',base)

Description

d = base2dec('strn',base) converts the string number strn of the specified base into its decimal (base 10) equivalent. base must be an integer between 2 and 36. If 'strn' is a character array, each row is interpreted as a string in the specified base.

Examples

The expression base2dec('212',3) converts 2123 to decimal, returning 23.



beep

Produce a beep sound

Syntax

  • beep
    beep on
    beep off
    s = beep

Description

beep produces you computer's default beep sound

beep on turns the beep on

beep off turn the beep off

s = beep returns the current beep mode (on or off)

besselh

Bessel function of the third kind (Hankel function)

Syntax

  • H = besselh(nu,K,Z)
    H = besselh(nu,Z)
    H = besselh(nu,K,Z,1)
    [H,ierr] = besselh(...)

Definitions

The differential equation

where is a nonnegative constant, is called Bessel's equation, and its solutions are known as Bessel functions. and form a fundamental set of solutions of Bessel's equation for noninteger . is a second solution of Bessel's equation - linearly independent of - defined by

The relationship between the Hankel and Bessel functions is

where is besselj, and is bessely.

Description

H = besselh(nu,K,Z) computes the Hankel function , where K = 1 or 2, for each element of the complex array Z. If nu and Z are arrays of the same size, the result is also that size. If either input is a scalar, besselh expands it to the other input's size. If one input is a row vector and the other is a column vector, the result is a two-dimensional table of function values.

H = besselh(nu,Z) uses K = 1.

H = besselh(nu,K,Z,1) scales by exp(-i*Z) if K = 1, and by exp(+i*Z) if K = 2.

[H,ierr] = besselh(...) also returns completion flags in an array the same size as H.


ierr
Description
0
besselh successfully computed the Hankel function for this element.
1
Illegal arguments.
2
Overflow. Returns Inf.
3
Some loss of accuracy in argument reduction.
4
Unacceptable loss of accuracy, Z or nu too large.
5
No convergence. Returns NaN.

Examples

This example generates the contour plots of the modulus and phase of the Hankel function shown on page 359 of [1] Abramowitz and Stegun, Handbook of Mathematical Functions.

It first generates the modulus contour plot

  • [X,Y] = meshgrid(-4:0.025:2,-1.5:0.025:1.5);
    H = besselh(0,1,X+i*Y);
    contour(X,Y,abs(H),0:0.2:3.2), hold on



then adds the contour plot of the phase of the same function.

  • contour(X,Y,(180/pi)*angle(H),-180:10:180); hold off




besseli

Modified Bessel function of the first kind

Syntax

  • I = besseli(nu,Z)
    I = besseli(nu,Z,1)
    [I,ierr] = besseli(...)

Definitions

The differential equation

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

and form a fundamental set of solutions of the modified Bessel's equation for noninteger . is defined by

where is the gamma function.

is a second solution, independent of . It can be computed using besselk.

Description

I = besseli(nu,Z) computes the modified Bessel function of the first kind, , 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. If one input is a row vector and the other is a column vector, the result is a two-dimensional table of function values.

I = besseli(nu,Z,1) computes besseli(nu,Z).*exp(-abs(real(Z))).

[I,ierr] = besseli(...) also returns completion flags in an array the same size as I.


ierr
Description
0
besseli succesfully computed the modified Bessel function for this element.
1
Illegal arguments.
2
Overflow. Returns Inf.
3
Some loss of accuracy in argument reduction.
4
Unacceptable loss of accuracy, Z or nu too large.
5
No convergence. Returns NaN.

Examples

Example 1.

  • format long
    z = (0:0.2:1)';

    besseli(1,z)

    ans =
    0
    0.10050083402813
    0.20402675573357
    0.31370402560492
    0.43286480262064
    0.56515910399249

Example 2. besseli(3:9,(0:.2,10)',1) generates the entire table on page 423 of [1] Abramowitz and Stegun, Handbook of Mathematical Functions.

Algorithm

The besseli functions uses a Fortran MEX-file to call a library developed by D. E. Amos [3] [4].

No comments:

Post a Comment