Advertisement
Guest User

lab 2

a guest
Jan 20th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. function [dydx] = der(f,x,h)
  2. dydx = (1/3)*(((f(x+h)-f(x-h))./(2*h))-((f(x+(2*h))-f(x-(2*h)))./(4*h)))
  3. end
  4.  
  5. function [d1,d2,d3] = pder(g,x1,h1,x2,h2,x3,h3)
  6. d1 = (1/3)*(((g(x1+h1,x2,x3)-g(x1-h1,x2,x3))./(2*h1))-((g(x1+(2*h1),x2,x3)-g(x1-(2*h1),x2,x3))./(4*h1)))
  7. d2 = (1/3)*(((g(x1,x2+h2,x3)-g(x1,x2-h2,x3))./(2*h2))-((g(x1,x2+(2*h2),x3)-g(x1,x2-(2*h2),x3))./(4*h2)))
  8. d3 = (1/3)*(((g(x1,x2,x3+h3)-g(x1,x2,x3-h3))./(2*h3))-((g(x1,x2,x3+(2*h3))-g(x1,x2,x3-(2*h3)))./(4*h3)))
  9.  
  10. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement