Advertisement
SilLAwNeD

Scilab, pointmilieu function

Nov 28th, 2018
2,058
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scilab 0.32 KB | None | 0 0
  1. function [z] = pointmilieu(a, t0, T, N, f)
  2.     h = T / N
  3.     p = size(a, 1)
  4.     z = zeros (p, N)
  5.     z(:, 1) = a
  6.     t = t0
  7.     for j = 2:N
  8.         z1 = z(:, j-1) + h/2 * f( t, z(:, j-1))
  9.         z(:, j) = z(:, j-1) + h * f( t + 1/2*h, z1)
  10.         t = t + h;
  11.     end
  12.  
  13.     //plot((t0:h:t0+T),z)
  14.    
  15. endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement