SETFUN_ELL_1D Sets functions and coefficients for ellprecofem_1d and ell_1d [uex,uexx,ff,nu,beta,gam]=setfun_ell_1d Output: uex =@(x)[....] function handle to the expression of exact solution uexx =@(x)[....] function handle to the expression of the first derivative of the exact solution ff =@(x)[....] function handle to the expression of function at right hand side nu = viscosity coefficient (constant>0) beta = coefficient of first-order term (constant) gam = coefficient of zero-order term (constant >=0)
0001 function [uex,uexx,ff,nu,beta,gam]=setfun_ell_1d 0002 % SETFUN_ELL_1D Sets functions and coefficients for ellprecofem_1d and ell_1d 0003 % 0004 % [uex,uexx,ff,nu,beta,gam]=setfun_ell_1d 0005 % 0006 % Output: uex =@(x)[....] function handle to the expression of exact 0007 % solution 0008 % uexx =@(x)[....] function handle to the expression of the first 0009 % derivative of the exact solution 0010 % ff =@(x)[....] function handle to the expression of function 0011 % at right hand side 0012 % nu = viscosity coefficient (constant>0) 0013 % beta = coefficient of first-order term (constant) 0014 % gam = coefficient of zero-order term (constant >=0) 0015 % 0016 0017 % Written by Paola Gervasio 0018 % $Date: 2007/04/01$ 0019 0020 syms x 0021 nu=1;gam=0; beta=0; 0022 Uex=cos((1+x)*pi*3).*sin((0.5+x)*pi/5)+sin(pi/10); % exact solution 0023 Uexx=diff(Uex,x); % first derivative of exact solution 0024 Ff=(gam*(Uex)-diff(nu*(Uexx))+beta*Uexx); % right hand side 0025 0026 % Ff=1+0*x; 0027 % Uex=0+0*x; 0028 uex=vectorize(char(Uex)); 0029 uexx=vectorize(char(Uexx)); 0030 ff=vectorize(char(Ff)); 0031 0032 uex=@(x)[eval(uex)]; 0033 uexx=@(x)[eval(uexx)]; 0034 ff=@(x)[eval(ff)]; 0035