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