Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The routine I used for Problem 1 to generate A was: Problem 2, We will assume that the forcing is f(x) = sin 51x. (i)
The routine I used for Problem 1 to generate A was:
Problem 2, We will assume that the forcing is f(x) = sin 51x. (i) Generate b for this forcing, taking L=1 and n+1=201. Using your routine in Problem 1 to generate A, solve the corresponding linear system using matlab's backslash solver: i.e. u=A\b. Include a plot of this solution, and save it for later parts of this problem. (ii) Implement SOR for solving an nxn linear solver. The input arguments to your function should be n, A, b, initial approximation Wo the SOR parameter w, and the number of iterations, and the output should be the approximate solution w to the linear system: function (w]=SOR(n,A, b, wo, w, niterations) With n+1= 201, initial approximation 0, and w = 1, apply 3000 iterations of SOR to obtain the approximation w. Plot the residual r= b-Aw and the error e= u-W on the same plot. Repeat the same process but for w = 1.25. Compare the results for the two different parameter choices. (iii) Using the better parameter that gave a faster convergence rate, solve the system for n+1=51. Note that because the size of the systems is 4 times smaller, it requires less computation. Does the approximation have the same profile as the solution u. How can you use this fact for improving the efficiency for the n+1=201 case? (Hint: the initial approximation for SOR affects the efficiency of the computation.) Your driver should have the following structure 1. Initialize/read in Lin,w, and form Ax 2. Call generate_matrix code to form A 3. Form b, and compute the solution using matlab's backsolver 4. Obtain the approximate solution calling your SOR routine 5. Post-processing- plotting residual and error, etc. We will be consider a diffusive process in an infinitesimally thin domain of length L, which we can take to be the line segment [O, L). The problem may represent the diffusion of heat or some species in the domain. The mathematical formulation for our model is given by the equations 02u(x) 2 = f(x) 0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started