MATLAB plotting $\log(h)$ vs. $\log(e(h))$

52 Views Asked by At

So I have the initial value problems below. From a previous part, I have already confirmed that $v(t)$ is a solution to the the problem above it. Now I am left to write a MATLAB code that plots $\log(h)$ vs $\log(e(h))$ and that verifies that the Euler Method's approximation is first order by computing the error $e(h)$.

I understand that we must have $e(h) = O(h)≈C·h^p$ for some constant $C$. Which then means $e(h) = p·\log(h)+C_1$, if I am correct. But I am confused on how I should first approach the problem.

Any hints or referrals to tutorials, I looked online but didn't find anything helpful. Thank you.

\begin{align} y'(t)&=-y(t)+t+1,\qquad t\in[0,1],\\ y(0)&=1,\\ \\ v(t)&=e^{-t}+t \end{align}