0% found this document useful (0 votes)
27 views16 pages

Orthogonal Collocation & Finite Difference Methods in MATLAB

The document outlines various numerical methods for solving differential equations, including orthogonal collocation, shooting methods, and finite difference methods. It provides MATLAB code snippets for implementing these methods at different collocation points and grid sizes. Additionally, it includes Taylor series expansions for finite difference equations related to heat flow analysis.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views16 pages

Orthogonal Collocation & Finite Difference Methods in MATLAB

The document outlines various numerical methods for solving differential equations, including orthogonal collocation, shooting methods, and finite difference methods. It provides MATLAB code snippets for implementing these methods at different collocation points and grid sizes. Additionally, it includes Taylor series expansions for finite difference equations related to heat flow analysis.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Solution:

(a)
(i) Using orthogonal collocation method at one interior collocation point:
The traial fuction will be :
N

θ = 1 + ∑ C i(xi+1- x)
i

θ (0) ✓ θ (1) ✓ satisfy the boundry condition.


Now apply the orthognal method in matlab at x= 0.5 and θ= 1 + C1 (x2-x) by
building the following code:
Result:

(ii) Using orthogonal collocation method at two interior collocation point:


The traial fuction will be :
N=2

θ = 1 + ∑ C i(xi+1- x) + (X3-x)
i

θ (0) ✓ θ (1) ✓ satisfy the boundry condition.


Now apply the orthognal method in matlab at x=1/ 3& 2/ 3
and θ= 1 + C1 (x2-x) + C2 (x3 – x) by bulding the following code:
Result:
(b)
(i) using shooting method (interpolation technique):

Matlab code:

Result:
(ii) solution using shooting method by newton technique:

Matlab code:

Result:
(C) by finite difference method using 10 grind points:

Matlab code:

Result:
Using taylor series to solve fininte difference method as follow:
y i +1−2 y i+ y i−1
y 'i ' =
( ∆ x )2
y i+1 − y i−1
y i '=
2∆ x

Subtitute into equation


y i+1−2 y i + y i−1 y i +1− y i−1
(∆x) 2
−2 ( 2∆ x ) −10 y i=0

1 1 2 1 1
( +
(∆ x ) ∆ x
2
y i−1−
) (
(∆ x ) 2
+10 y i− −
) ( y =0
∆ x ( ∆ x )2 i +1 )
α y i−1− β y i−γ y i+1=0
Where
1 1
α =¿ +
(∆ x ) ∆ x
2

2
β=¿ +10
( ∆ x )2
1 1
γ =¿ −
∆ x ( ∆ x )2

For the boundary conditions

y 2− y 0
=2 ( y 1−1 )
2∆ x
y 0= y 2+ 4 ∆ x−4 ∆ x y 1

y N +1− y N−1
=0
2∆ x
y N+1 = y N −1

The final equations are


( α −γ ) y 2−( β+ 4 α ∆ x ) y 1=−4 α ∆ x for I =1
α y i−1− β y i−γ y i+1=0for i=2,3,…N-1

( α −γ ) y N −1−β y N =0 for i=N


Matlab code:

Result:
For one grid point

For five grid points


For ten grid points
(i) Matlab code:

(i) Result
(ii) Matlab code

(ii) Result
Using Taylor series to write the finite difference equations for the heat flow as follow:

2 T i+1. j−2 T i. j +T i−1. j T i . j+1−2 T i . j +T i. j−1


∇ T i . j= + =0
∆ x2 ∆ y2
Since the plate divided equally ∆ x=∆ y

∇ 2 T i . j=T i+1. j +T i . j+1 +T i−1. j +T i . j−1−4 T i . j=0

Matlab code:
Results
For 3 inch results

For 2 inch results

For 1 inch results

You might also like