Question: I'm trying to write a code in matlab, such that it solves for a system Ay=b, where A is a square matrix of constant element

I'm trying to write a code in matlab, such that it solves for a system Ay=b, where A is a square matrix of constant element values, b is a single column matrix of known values, and y is a single column matrix of unknown values. The code must use LU factorization and solve (values for matrix y) for any system of size 'n'. I am having a hard time generating a code for matrix b, and then imputing it into a code that uses LU factization.
 I'm trying to write a code in matlab, such that it
solves for a system Ay=b, where A is a square matrix of

OVERVIEW f- Use LU factorization to solve the linear system that arises from approximating a di ferential equation. Part I will focus on the algorithm to solve the system, and then next week, Part II will focus on using the plot() command to display graphs of your solutions ACTIVITIES The differential equation to be solved is y'(0) -1/8 = on the domain 0 s s 1. The true solution is y()12b we will only use this at the end to test how well our approximation scheme worked. To solve this equation numerically, we will first partition the domain of z into n subintervals. Each subinterval will have width Ar- , and the node points z, are If we use a larger n, we will get a better approximation, but the trade off is that the linear system is larger. We will see this by comparing different values of n, but this means the code must be written for a generic n, which is a good habit to get into. The n unknowns in this problem are yi y). The boundary condition y(1)-1 gives us that yn+l 1, and so it is not an unknown. Now we will approximate the derivatives in terms of yi to get us n equations for these n unknowns. The first equation comes from the boundary condition y'(01. Think about the difference quotient definition of y (0): 8 y(Ar) - y(0) 1 Ar (Rennember that taking the limit of Ar-+ 0 will define exactly 3/(0).) We set this approximation equal to -1/8, and therefore we get the equation The remaining n-1 equations come from approximating y" z. Careful applica- tions of the limit definition of a derivative will lead us to the approximation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!