Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. function yi = SplineC1(x, y, dy, xi)
  2. n = length(x);
  3. for i=1:n-1
  4. a=y(i);
  5. d=y(i+1);
  6. h=x(i+1)-x(i);
  7. b=y(i) + h/3*dy(i);
  8. c=y(i+1) - h/3*dy(i+1);
  9. t=(xi-x(i))/h;
  10. if (xi >= x(i) && xi <= x(i+1))
  11. yi =a*(1-t)^3+3*b*t*(1-t)^2+3*c*t^2*(1-t)+d*t^3;
  12. endif
  13. endfor
  14. endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement