Advertisement
JoelSjogren

Untitled

Mar 23rd, 2017
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 0.33 KB | None | 0 0
  1. pkg load odepkg % needed in octave but not in matlab
  2.  
  3. % example input function f and domain [xmin, xmax]x[ymin, ymax]
  4. f = @(x, y) x+y.*y;
  5. xmin = 0, xmax = 2, ymin = 1, ymax = 2;
  6.  
  7. % integrated over x
  8. F = @(y) ode45(@(t, x) f(t, y), [xmin, xmax], 0);
  9. clf
  10. for y=ymin:0.1:ymax
  11.   [t, I] = F(y);
  12.   disp(I')
  13.   plot(t, I), hold on
  14. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement