% ========================================================================
% Reaction-Diffusion Equation with Neumann boundary conditions.
% Find the singular values of the frequency response operator TTs
% using integral formulation method.
%
% additional m-file needed: svdfr
%
% written by: Binh Lieu
% ========================================================================

% domain
dom = domain(-1,1);
y = chebfun('y',dom);

% one and zero functions
fone = chebfun(1,dom);
fzero = chebfun(0,dom);

% system parameters
om = 1;
c = 1;

% System operators
% Coefficients of the A0 operator for the 1D diffusion equation
A0{1} = [-(1i*om + 1)*fone, fzero, fone]; % -(i*om + c)*phi + 0*phi' + phi''   
B0{1} = -fone; % -d (right-hand-side of the equation)
C0{1} = fone; % phi, desired output
 
% Boundary conditions:
Wa0{1} = [0, 1];   % 0*\phi(-1) + 1*\phi'(-1) = 0
Wb0{1} = [0, 1];   % 0*\phi(+1) + 1*\phi'(+1) = 0
 
% Singular value decomposition of the frequency response operator can be
% computed using the following code
LRfuns = 1;    % find the left singular functions
Nsigs = 6;    % find the largest 25 singular values
 
[Sfun, Sval] = svdfr(A0,B0,C0,Wa0,Wb0,LRfuns,Nsigs);
