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

• Homework Help
• 12
• 100% (2) 2 out of 2 people found this document helpful

This preview shows page 1 - 5 out of 12 pages.

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 diff
1
2.Write down the matrix equation to solve in order to find the finite difference approxima-tion withN= 4for the same diff
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)X=linspace(1,3,N+1);Q=DX^2*diag(X);Q(1,1)=0;Q(N+1,N+1)=0;Define the right side of the equation for the boundary conditions of the first problem.
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.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 12 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
RICHARDFROESE
Tags
Interior, Boundary value problem, Normal mode, Boundary conditions