You are on page 1of 7

Rayleigh‐Ritz


Method

Example
2.4


“Introduc=on
to
the
Finite
Element

Method”
–
JN
Reddy


Massimo Ruzzene
School of Aerospace Engineering
massimo.ruzzene@ae.gatech.edu
AE 6104 – Computational Mechanics Ph: (404) 894 3078
Procedure


•  Find
weak
form

•  Define
B(w,u)
and
l(w)
operator

•  Select
approxima=on
func=ons

•  Compute
B
and
f
terms

•  Solve
resul=ng
algebraic
problem


Massimo Ruzzene
School of Aerospace Engineering
massimo.ruzzene@ae.gatech.edu
AE 6104 – Computational Mechanics Ph: (404) 894 3078
A
simple
Matlab
program

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Rayleigh‐Ritz
Method%AE6104
‐
Computa=onal
Mechanics
(Spring
2009)

%Example
2.4
Introduc=on
to
the
Finite
Element
Method

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear,
close
all,
clc


%Computa=onal
domain

x=linspace(0,1,100);
 %Calculate unknown coefficients
c=inv(B)*f;

%Order
of
approxima=on

%Compute response
n=1;
 u=zeros(size(x));

%Exact
solu=on

u_N=1/sin(1)*(sin(x)+2*sin(1‐x))+x.^2‐2;
 for i=1:n
Phi=(x.^(i)).*(1-x); u=u+c(i)*Phi;
end

for
i=1:n








%Approxima=on
func=ons
and
their
first
deriva=ve


 %Plot result agaisnt exact solution


Phi=(x.^(i)).*(1‐x);



Phi_x=i*x.^(i‐1)‐(i+1)*x.^i;



figure(1)





for
j=1:n




 plot(x,u,'o','linewidth',2), hold on




Phj=(x.^(j)).*(1‐x);







Phj_x=j*x.^(j‐1)‐(j+1)*x.^j;





 plot(x,u_ex,'r','linewidth',2)






%B
matrix






 xlabel('x','fontweight','bold','fontsize',12)
ylabel('u','fontweight','bold','fontsize',12)


B(i,j)=trapz(x,Phi_x.*Phj_x‐Phi.*Phj);





end





%f
vector





f(i,1)=‐trapz(x,(x.^2).*Phi);

end



Massimo Ruzzene
School of Aerospace Engineering
massimo.ruzzene@ae.gatech.edu
AE 6104 – Computational Mechanics Ph: (404) 894 3078
N=1


Massimo Ruzzene
School of Aerospace Engineering
massimo.ruzzene@ae.gatech.edu
AE 6104 – Computational Mechanics Ph: (404) 894 3078
N=2


Massimo Ruzzene
School of Aerospace Engineering
massimo.ruzzene@ae.gatech.edu
AE 6104 – Computational Mechanics Ph: (404) 894 3078
N=3


Massimo Ruzzene
School of Aerospace Engineering
massimo.ruzzene@ae.gatech.edu
AE 6104 – Computational Mechanics Ph: (404) 894 3078
Error


Massimo Ruzzene
School of Aerospace Engineering
massimo.ruzzene@ae.gatech.edu
AE 6104 – Computational Mechanics Ph: (404) 894 3078

You might also like