Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#2 |
初级会员
注册日期: 2009-04-22
年龄: 38
帖子: 3
声望力: 0 ![]() |
![]()
分段三阶hermit
function yhat=hermint(x,f,fp,xhat)%分段三阶hermite插值 n=length(x); if length(f)~=n,error('x and f are not compatible'); elseif length(fp)~=n,error('x and fp are not compatible');end x=x(: );xhat=xhat(: );f=f(: );fp=fp(: ); dx=diff(x); divdif=diff(f)./dx; a=f(1:n-1); b=fp(1:n-1); c=(3*divdif-2*fp(1:n-1)-fp(2:n))./dx; d=(fp(1:n-1)-2*divdif+fp(2:n))./dx.^2; i=zeros(size(xhat)); for m=1:length(xhat) i(m)=binSearch(x,xhat(m)); end xx=xhat-x(i); yhat=a(i)+xx.*(b(i)+xx.*(c(i)+xx.*d(i))); |
![]() |
![]() |