Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function yi = SplineC1(x, y, dy, xi)
- for i = 2 : length(x)
- if xi <= x(i)
- j = i - 1;
- break;
- endif
- endfor
- i = j;
- h(i) = x(i + 1) - x(i);
- t = (xi - x(j)) / (h(j));
- yi = y(j)*(1-t)^3+(3*y(j)+h(j)*dy(j))*t*(1-t)^2+(3*y(j+1)-h(j)*dy(j+1))*t^2*(1-t)+y(j+1)*t^3;
- endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement