- 1,798
- 33
Hi,
We all know that the finite difference formulae for the derivatives are given by:
<br /> \frac{dy}{dx}_{i}=\frac{y_{i}-y_{i-1}}{\delta x}<br />
and
<br /> \frac{d^{2}y}{dx^{2}}=\frac{y_{i-1}-2y_{i}+y_{i+1}}{\delta x^{2}}<br />
What would be the formulae for the boundary terms? when i=1? I think I can show that:
<br /> \frac{dy}{dx}_{0}=\frac{4y_{1}-y_{2}}{3}<br />
Are there any other formulae? What about the second order derivative?
This is for a numerical code in matlab, I can use inbuilt functions but I want my code to run as fast as possible.
Mat
We all know that the finite difference formulae for the derivatives are given by:
<br /> \frac{dy}{dx}_{i}=\frac{y_{i}-y_{i-1}}{\delta x}<br />
and
<br /> \frac{d^{2}y}{dx^{2}}=\frac{y_{i-1}-2y_{i}+y_{i+1}}{\delta x^{2}}<br />
What would be the formulae for the boundary terms? when i=1? I think I can show that:
<br /> \frac{dy}{dx}_{0}=\frac{4y_{1}-y_{2}}{3}<br />
Are there any other formulae? What about the second order derivative?
This is for a numerical code in matlab, I can use inbuilt functions but I want my code to run as fast as possible.
Mat