MATLAB: Taylor and Euler Method for ODE

homework

y'-sin(4t)=0 y(0)=-0.25. 1. Use Taylor method to solve up to t4 for 20 steps, h=0.1.

Best Answer

MATLAB is a 0-based indexing language. So you can't have y(0) in your code. It will need to start at y(1).
y(1)= -0.25;
Also, you need to index into your t vector as t(i):
Dy(i)=sin(4*t(i));