Docsity

Partial Differential Equations-Machine Learning and MATLAB-Lecture Slides, Slides of Machine Learning

Partial preview of the text

Download Partial Differential Equations-Machine Learning and MATLAB-Lecture Slides and more Slides Machine Learning in PDF only on Docsity!

Chapter 11Partial Differential Equations

Dr. Muhammad Hanif DuradDepartment of Computer and Information SciencesPakistan Institute Engineering and Applied [email protected]

Most of the codes have been adopted from various books forNumerical Computing using MATLAB their references have beengiven in short on each topic

docsity.com

Dr. Hanif Durad^

Lecture Outline  Example MOL for one-way wave equation  Heat Equation Solution  Forward Difference Method (Analytical solutionassignment)  Backward Difference Method (Assignment)  Crank-Nicolson Method

docsity.com

Wave Equation-Solved Examplef=@(x) sin(pi*x)g=@(x) 0u=finedif (f,g,1,1,1,6,6)u = 0 0.5878^ 0.

0.9511^ 0.

0 0 0.4755^ 0.

0.7694^ 0.

0 0 0.1816^ 0.

0.2939^ 0.

0 0 -0.1816^ -0.

-0.2939^ -0.

0 0 -0.4755^ -0.

-0.7694^ -0.

0 0 -0.5878^ -0.

-0.9511^ -0.

0

B4, P-325Kreyszig_AEM 8e, P-548, 928

docsity.com

Iterative Methods for LinearSystems

docsity.com

Iterative Refinement Example(1/2)^ ^ Chapra B1 old, P-287, Problem 10.

Dr. Hanif Durad^

(^8) docsity.com

Iterative Refinement-Assignment

Dr. Hanif Durad^

^ Chapra B1 new, P-260, Problem 9.

docsity.com

  1. Jacobi Method (1/3)>>A=[4 -1 -1 0;-1 4 0 -1;-1 0 4 -1;0 -1 -1 4]>>v = diag(A)>>D= diag(v)>>M=D>> L = tril(A,-1)>> U = triu(A,1)>> N=-(L+U)>> M^-1*N>> eig(ans)^

Dr. Hanif Durad^

test ??

docsity.com

Jacobi Method (3/3)  Varying no. of iterations>> max1=13max1 = (^13) >> X=jacobi(A,b,x0,delta, max1)X =0.12500.12500.37500.

Dr. Hanif Durad^

(^13) docsity.com

  1. Gauss-Seidel Method (1/2)>>A=[4 -1 -1 0;-1 4 0 -1;-1 0 4 -1;0 -1 -1 4]>>v = diag(A)>>D= diag(v)>> L = tril(A,-1)>>M=D+L>> U = triu(A,1)>> N=-U>> M^-1*N>> eig(ans)

Dr. Hanif Durad^

test ??

docsity.com

3. Successive over Relaxation(SOR) (1/2)

Dr. Hanif Durad^

  • Crank-Nicolson Method>> crankans =4.0000 -1.0000^0
    • -1.0000 4.0000 -1.
    • 0 00 -1.0000 4.0000 -1.0000^00 0 -1.0000 4.0000 -1.0000 0 0 0 -2.0000 4.0000 0 0.2000 0.4000 0.6000 0.8000 1.
      • 0.0100 0.1989 0.
      • 0.5834 0.7381 0.
        • 0.0200 0.1936 0.
        • 0.5397 0.6461 0.
          • 0.0300 0.1826 0.
          • 0.4902 0.5843 0.
            • 0.0400 0.1683 0.
            • 0.4461 0.5267 0.
              • 0.0500 0.1538 0.
              • 0.4047 0.4770 0.
                • 0.0600 0.1399 0.
                • 0.3672 0.4321 0.
                  • 0.0700 0.1270 0.
                  • 0.3330 0.3916 0.
                    • 0.0800 0.1153 0. - 0.3019 0.3550 0. - 0.0900 0.1045 0. - 0.2738 0.3219 0. - 0.1000 0.0948 0. - 0.2482 0.2918 0. - EssentialMatlab2e, P-381Kreyszig_AEM 8e, P-556, - X=SOR(A,b,1.072)i x - x2 x - 1.0000 - 0 0. - 0. - 2.0000 0. - 0.1103 0. - 0. - 3.0000 0. - 0.1234 0. - 0. - 4.0000 0. - 0.1249 0. - 0. - 5.0000 0. - 0.1250 0. - 0. - 6.0000 0. - 0.1250 0. - 0. - 7.0000 0. - 0.1250 0. - Calculated value of ω=1.072 0.

Successive over Relaxation(SOR) (2/2)

Dr. Hanif Durad^

SOR Method converged in

8 iterations X = 0.12500.12500.37500.

docsity.com

Dr. Hanif Durad^

(^19) docsity.com