Advertisement
faenil

Untitled

Mar 11th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. function pol = hermite( x, y, d, u)
  2. n = length(x)
  3. upperV = repmat(x', 1, 2*n)
  4. upperV = bsxfun(@power, upperV, [2*n-1:-1:0])
  5. lowerV = repmat(x', 1, 2*n)
  6. lowerV = bsxfun(@power, lowerV, [2*n-2:-1:0 , 1])
  7. lowerV = bsxfun(@times, lowerV, [2*n-1:-1:1 , 0])
  8. V = [upperV; lowerV]
  9. a = V \ [y.' ; d.' ]
  10. pol = polyval(a, u)
  11. endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement