Question
As discussed in class: create a computer program that will numerically solve the equation: - d2u/dx2 + u = x du/dx = 0 at x=0,1.
As discussed in class: create a computer program that will numerically solve the equation:
- d2u/dx2 + u = x
du/dx = 0 at x=0,1.
Please submit the homework on paper.
If you get stuck, please ask in class. I prefer that you ask in class than that you come to office hours. If you are still stuck after we go over it in class, then come to office hours. Look at Section 8.1 for ideas.
Include the code, a brief explanation of the code, and a plot of the answer. Full credit will only be given if you include x=0,1 on the plot.
please show how to do this with matlab and show the plot for the solution thank you
Here is an example:
Here is the example for - d2u/dx2 + u=1
x bigger or equal to 0 and lesser or equal to 1
u(0)=u(1)=0 solve numerically mesh xi =1
0
h=1
n=100; h=1; A=zeros(n-1, n-1); for i=1:n-1, if (i-1)0) A(i,i-1)=-1/h^2; end if (i+1Step 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