Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Programming Poisson's Equation: Error Analysis and Solution Visualization - Prof. Yanqiu W, Assignments of Mathematics

This programming assignment involves solving poisson's equation using the standard five-point finite difference scheme on uniform grids with different resolutions (16 × 16, 32 × 32, 64 × 64, and 128 × 128). The goal is to compute the maximum norm of the error between the exact solution and the finite difference solution and to plot the numerical solution on a 20 × 20 grid. The assignment provides instructions on how to use matlab functions such as 'delsq', 'x = a ', and 'reshape' to generate the stiffness matrix, solve a linear system, and plot the matrix as a surface.

Typology: Assignments

Pre 2010

Uploaded on 03/10/2009

koofers-user-jwo
koofers-user-jwo 🇺🇸

10 documents

1 / 1

Toggle sidebar

Related documents


Partial preview of the text

Download Programming Poisson's Equation: Error Analysis and Solution Visualization - Prof. Yanqiu W and more Assignments Mathematics in PDF only on Docsity! Programming assignment 4 1. Solve the Poisson’s equation in Ω = (0, 1) × (0, 1): { −∆u = 2π2 sin(πx) sin(πy) in Ω, u = 0 on ∂Ω, by the standard five-point finite difference scheme on a uniform M × M grid. The step size is h = 1/M . The exact solution for this problem is u = sin(πx) sin(πy). (a) Compute the maximum norm of error ‖u − v‖∞ on grid points, where v is the finite difference solution. Report the error for 16 × 16, 32 × 32, 64 × 64 and 128 × 128 grids. Does your result agree with the error estimate ‖u − v‖∞ = O(h 2). (b) Plot the numerical solution on a 20 × 20 grid. Note: • You may use the Matlab build-in function “delsq” to generate the stiffness matrix. However, you will need to read the help file and make sure you use it correctly. • To solve a linear system Ax = f , where x, and f are n-dim column vectors, you can use the Matlab command “x = A\ f”. • A useful Matlab command is “reshape”, which returns a matrix whose elements are taken column-wise from a given vector or matrix. For example, let column vector x = [1, 2, 3, 4]t. “y=reshape(x,2,2)” will return a 2 × 2 matrix y = ( 1 2 3 4 ) . Then you can use command “surf(y)” to plot the matrix as a surface. 1
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved