solutions1.3 - Math 307: Problems for section 1.3 1. Write down the vector approximating f x at interior points the vector approximating xf x at | Course Hero

Upload to Study

Expert Help

Study Resources

Log inJoin

solutions1.3 - Math 307: Problems for section 1.3 1. Write...

Math 307: Problems for section 1.31.Write down the vector approximatingf′′(x)at interior points, the vector approximatingxf(x)at interior points, and the finite difference matrix equation for the finite differenceapproximation withN= 4for the differential equationf′′(x) +xf(x) = 0for1≤x≤3subject tof(1) = 1,f(3) =−1.

View full document

1

2.Write down the matrix equation to solve in order to find the finite difference approxima-tion withN= 4

View full document

3.Use MATLAB/Octave to solve the matrix equations you derived in the last two prob-lems for the vector F that approximates the solution (i.e., withN= 4).Then redo thecalculation withN= 50and plot the resulting functions.For defineNand ΔxN=4;DX=2/N;Define the matrixLwhereLFcorresponds tof′′(x)L=diag(-2*ones(1,N+1))+diag(ones(1,N),1)+diag(ones(1,N),-1);L(1,1)=1;L(1,2)=0;L(N+1,N)=0;L(N+1,N+1)=1;Define the matrixQwhereQFcorresponds toxf(x)

View full document

Define the right side of the equation for the boundary conditions of the first problem.

View full document

2

Solve forFF=(L+Q)\bThe result isF =1.000000.17778-0.71111-1.24444-1.00000To solve the second problem we have to change the terms corresponding to the boundary conditions.L(1,1)=-1;L(1,2)=1;b(1)=DX;F=(L+Q)\bThe result isF =1.653852.153851.846150.61538-1.00000For the second part of the problem we changeN=4toN=50above. Then at the end, we can plot thesolution against the correct values ofxusingplot(X,F);Here are the resulting plots:-1-0.500.511.5211.522.533

Questions 4–6 deal with the steady heat equation in a one-dimensional rod considered inthe notes:0 =kT′′(x)−HT(x) +S(x),wherekandHare constants, subject to the boundary conditionsT=Tlatx=xlandT=Tratx=xr.

Want to read all 12 pages?

Previewing 5 of 12 pages Upload your study docs or become a member.

View full document

Want to read all 12 pages?

Previewing 5 of 12 pages Upload your study docs or become a member.

View full document

End of preview

Want to read all 12 pages? Upload your study docs or become a member.