Code covered by the BSD License  

Highlights from
Galerkins method over "ne" elements for solving 2nd-order homogeneous, c.c BVP

5.0

5.0 | 1 rating Rate this file 14 Downloads (last 30 days) File Size: 603 KB File ID: #40153
image thumbnail

Galerkins method over "ne" elements for solving 2nd-order homogeneous, c.c BVP

by

 

Implement Galerkin method over "ne" individual elements for solving 2nd order BVPs

| Watch this File

File Information
Description

The purpose of this program is to implement Galerkin method over "ne" individual elements for solving the following general 2nd order,
homogeneous, Boundary Value problem (BVP) with constant coefficients, and then comparing the answer with the exact solution.

ax"(t)+bx'(t)+cx(t)=0 for t1<=t<=t2
BC: x(t1)=x1 and x(t2)=x2

>> BVP_Galerkin(a,b,c,t1,t2,x1,x2,ne)
where "ne" is the number of elements

The output of this program is
1- The approximated x(t) vs. exact x(t)
2- The approximated x'(t) vs. exact x'(t)
3- The approximated x"(t) vs. exact x"(t)

Example:
x"(t)+ 0.5x'(t)+ 10x(t)=0
BC: x(1)=2, x(10)=0;
Solution: We have: a=1;b=2;c=3;
t1=1;t2=10;
x1=2;x2=0;
Using ne=128 elements,
>>BVP_Galerkin2(1,2,3,1,10,2,0,128)

MATLAB release MATLAB 7.11 (R2010b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
05 Feb 2013 solmaz salehian  
04 Feb 2013 Zoltán Csáti

The code can be easily followed, however there are places where the program could be vectorized. Moreover the solution of the final linear system MUST NOT be solved with function inv!

Contact us