Docsity

Finite Element Method 2-Numerical Analysis-MATLAB Code, Exercises of Mathematical Methods for Numerical Analysis and Optimization

Toggle sidebar
bg1
function [res] = G2(X,Y)
% This function is used by Finite Element Method
% (Algorithm 12.5) to implement g2.
syms('T','Z1');
T = 1.0E-05;
Z1 = 0;
if 0.2-T <= X & X <= 0.4+T & abs(Y-0.2) <= T
Z1 = X;
end;
if 0.5-T <= X & X <= (0.6+T) & abs(Y-0.1) <= T
Z1 = X;
end;
if -T <= Y & Y <= 0.1+T & abs(X-0.6) <= T
Z1 = Y;
end;
if -T <= X & X <= 0.2+T & abs(Y+X-0.4) <= T
Z1 = (X+Y)/sqrt(2);
end;
if 0.4 -T <= X & X <= 0.5+T & abs(Y+X-0.6) <= T
Z1 = (X+Y)/sqrt(2);
end;
res = Z1;
docsity.com

Partial preview of the text

Download Finite Element Method 2-Numerical Analysis-MATLAB Code and more Exercises Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

function [res] = G2(X,Y) % This function is used by Finite Element Method % (Algorithm 12.5) to implement g2. syms('T','Z1'); T = 1.0E-05; Z1 = 0; if 0.2-T <= X & X <= 0.4+T & abs(Y-0.2) <= T Z1 = X; end; if 0.5-T <= X & X <= (0.6+T) & abs(Y-0.1) <= T Z1 = X; end; if -T <= Y & Y <= 0.1+T & abs(X-0.6) <= T Z1 = Y; end; if -T <= X & X <= 0.2+T & abs(Y+X-0.4) <= T Z1 = (X+Y)/sqrt(2); end; if 0.4 -T <= X & X <= 0.5+T & abs(Y+X-0.6) <= T Z1 = (X+Y)/sqrt(2); end; res = Z1;

docsity.com