Code covered by the BSD License  

Highlights from
Chebfun V4

image thumbnail

Chebfun V4

by

 

30 Apr 2009 (Updated )

Numerical computation with functions instead of numbers.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

chebop_systemeig
function pass = chebop_systemeig
% Eigenvalue test, inspired by Maxwell's equation.
% The eigenvalues are computed first on a global
% domain, then on a piecewise domain.
% (A level 3 Chebtest)

%% Smooth domain
d = [0 pi];
A = chebop(@(x,u,v) [-u + diff(v), diff(u)], d);
A.lbc = @(u,v) u;
A.rbc = @(u,v) u;

[V D] = eigs(A,5);
lam = diag(D);

lamcorrect = [
 -0.000000000000000                                       
 -0.499999999999999+ 0.866025403784436i
 -0.499999999999999- 0.866025403784436i
 -0.500000000000001+ 1.936491673103704i
 -0.500000000000001- 1.936491673103704i
 ];

pass(1) = norm( lam-lamcorrect, inf ) < 1e-12;

%% Piecewise domain
A.domain = domain(0,pi/2,pi);
[V D] = eigs(A,5);
lam_pw = diag(D);
pass(2) = norm( lam_pw-lamcorrect, inf ) < 1e-12;

Contact us