Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A = [ -2, 1; 1, -2 ];
- B = @(t) [ 2 * sin(t); 2*(cos(t)-sin(t)) ];
- func = @(t,y) (A*y+B(t));
- intv = [0 10];
- y0 = [2; 3];
- N0 = 100;
- fex = @(t) [ 2 * exp(-t) + sin(t); 2 * exp(-t) + cos(t) ];
- [teul, yeul, eveul] = mieuler(func, intv, y0, N);
- hold on
- plot(teul, yeul)
- plot(teul, fex(teul))
- hold off
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement