Guest User

Untitled

a guest
May 22nd, 2019
60
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function y=pred_cor3(a,b,n,y0,f)
  2.  
  3. h=(b-a)/n;
  4. x(1:n+1)=a+h*[0:n];
  5. y=RK44(a,b,n,y0,f);
  6.  
  7. for i=3:n
  8.  
  9. aux1=h*feval(f,x(i),y(i));
  10. aux2=h*feval(f,x(i-1),y(i-1));
  11. aux3=h*feval(f,x(i-2),y(i-2));
  12.  
  13. y_pr=y(i)+(1/12)*(23*aux1-16*aux2+5*aux3);
  14. y_cor=y(i)+(1/12)*(h*5*feval(f,x(i+1),y_pr)+8*aux1-aux2);
  15. y(i+1)=y_cor;
  16.  
  17. endfor
  18.  
  19.  
  20. endfunction
RAW Paste Data