Home > Src > Level_2 > setfun_lap_2d.m

setfun_lap_2d

PURPOSE ^

SETFUN_LAP_2D Sets functions and coefficients for lap_2d

SYNOPSIS ^

function [uex,uexx,uexy,ff,g,h,gam]=setfun_lap_2d

DESCRIPTION ^

  SETFUN_LAP_2D  Sets functions and coefficients for lap_2d

    [uex,uexx,uexy,ff,gam]=setfun_lap_2d

 Output: uex =@(x,y)[....] function handle to the expression of exact
               solution
         uexx =@(x,y)[....] function handle to the expression of the first 
               x-derivative of the exact solution
         uexy =@(x,y)[....] function handle to the expression of the first 
               y-derivative of the exact solution
         ff =@(x,y)[....] function handle to the expression of function 
              at right hand side
         g =@(x,y)[....] function handle to the expression of Dirichlet 
              boundary data
         h =@(x,y)[....] function handle to the expression of Neumann 
              boundary data. It is a vector of 4 functions, each for any
              side. 
         gam = coefficient of zero-order term (constant >=0)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [uex,uexx,uexy,ff,g,h,gam]=setfun_lap_2d
0002 %  SETFUN_LAP_2D  Sets functions and coefficients for lap_2d
0003 %
0004 %    [uex,uexx,uexy,ff,gam]=setfun_lap_2d
0005 %
0006 % Output: uex =@(x,y)[....] function handle to the expression of exact
0007 %               solution
0008 %         uexx =@(x,y)[....] function handle to the expression of the first
0009 %               x-derivative of the exact solution
0010 %         uexy =@(x,y)[....] function handle to the expression of the first
0011 %               y-derivative of the exact solution
0012 %         ff =@(x,y)[....] function handle to the expression of function
0013 %              at right hand side
0014 %         g =@(x,y)[....] function handle to the expression of Dirichlet
0015 %              boundary data
0016 %         h =@(x,y)[....] function handle to the expression of Neumann
0017 %              boundary data. It is a vector of 4 functions, each for any
0018 %              side.
0019 %         gam = coefficient of zero-order term (constant >=0)
0020 %
0021 
0022 %   Written by Paola Gervasio
0023 %   $Date: 2007/04/01$
0024 
0025 
0026 syms  x y
0027 gam=0;
0028 %Uex=sin(2*pi*x)*cos(2*pi*y); % exact solution
0029 Uex=sin(pi*x)*cos(pi*y);
0030 Uexx=diff(Uex,x); % first x-derivative of exact solution
0031 Uexy=diff(Uex,y); % first y-derivative of exact solution
0032 Uexx2=diff(Uexx,x); % second x-derivative of exact solution
0033 Uexy2=diff(Uexy,y); % second y-derivative of exact solution
0034 Ff=(gam*(Uex)-(Uexx2+Uexy2)); % right hand side
0035 H1=-diff(Uex,y);  % Neumann data on Side 1
0036 H2=diff(Uex,x);  % Neumann data on Side 2
0037 H3=diff(Uex,y);  % Neumann data on Side 3
0038 H4=-diff(Uex,x);  % Neumann data on Side 4
0039 
0040 uex=vectorize(char(Uex));
0041 uexx=vectorize(char(Uexx));
0042 uexy=vectorize(char(Uexy));
0043 ff=vectorize(char(Ff));
0044 h1=vectorize(char(H1));
0045 h2=vectorize(char(H2));
0046 h3=vectorize(char(H3));
0047 h4=vectorize(char(H4));
0048 
0049 uex=@(x,y)[eval(uex)];
0050 uexx=@(x,y)[eval(uexx)];
0051 uexy=@(x,y)[eval(uexy)];
0052 ff=@(x,y)[eval(ff)];
0053 g=@(x,y)[eval(uex)];
0054 h=@(x,y)[eval(h1);eval(h2);eval(h3);eval(h4)];
0055

Generated on Fri 21-Sep-2007 10:07:00 by m2html © 2003