By Mark S. Gockenbach (siam, 2010)


Section 8.3: Fourier series on a disk



Download 2.45 Mb.
Page19/25
Date09.06.2018
Size2.45 Mb.
#53772
1   ...   15   16   17   18   19   20   21   22   ...   25

Section 8.3: Fourier series on a disk

The Bessel functions Jn(s) are built-in functions in MATLAB, just as are the more common elementary function such as sine and cosine, and can be used just as conveniently. For example, here is the graph of J0:


clear

t=linspace(0,10,101);



plot(t,besselj(0,t));grid


(Notice that the first argument to besselj is the index n.)
As an example, I will compute the smallest root s01, s02, s02 of J0. The above graph shows that these roots are approximately 2.5, 5.5, and 8.5. Recall that the command fzero finds a (floating point estimate of) a root, near a given estimate, of a function. We have a slight difficulty in applying fzero to besselj, however, since besselj takes two arguments, and the first is the parameter n. Like most MATLAB functions that operate on functions, fzero will allow us to pass a parameter through to the user-defined function, but the parameter must come after the variable in the calling sequence. I will get around this problem by defining a function of one variable that represents J0:
J0=@(x)besselj(0,x)

J0 =


@(x)besselj(0,x)
Now I can invoke fzero:
fzero(J0,2.5)

ans =


2.4048
fzero(J0,5.5)

ans =


5.5201
fzero(J0,8.5)

ans =


8.6537

Graphics on the disk

Functions on a disk are naturally described by cylindrical coordinates, that is, as where are polar coordinates. We can use surf to graph such functions; however, it requires a little extra work to set up the grid. Here is how it works:

First, set up one-dimensional grids in r and θ (A is the radius of the disk):
clear

A=1;

r=linspace(0,A,21);

th=linspace(0,2*pi,21);


Next, use meshgrid to set up a rectangular grid in r and θ:
[R,Th]=meshgrid(r,th);
Now compute the function I will use for this example:
Z=R.*cos(Th);
Next, create matrices X and Y containing the coordinates:
X=R.*cos(Th);

Y=R.*sin(Th);


Now I can plot the surface:
surf(X,Y,Z)


Here is a more interesting example. I will graph the eigenfunction on the unit disk. First I must compute the root s11 of J1:
clear

J1=@(x)besselj(1,x);

t=linspace(0,10,101)';

plot(t,J1(t));grid




s11=fzero(J1,4)

s11 =


3.8317
Now I define the various grids:
r=linspace(0,1,21);

th=linspace(0,2*pi,21);

[R,Th]=meshgrid(r,th);

X=R.*cos(Th);



Y=R.*sin(Th);
Next I define the function
Z=besselj(1,s11*R).*cos(Th);
Finally, I can graph the surface:
surf(X,Y,Z)





Download 2.45 Mb.

Share with your friends:
1   ...   15   16   17   18   19   20   21   22   ...   25




The database is protected by copyright ©ininet.org 2024
send message

    Main page