matlab自己编写插值方法-好用

来源:互联网 发布:自动发卡源码正版 编辑:程序博客网 时间:2024/06/05 04:42

function y0=chazhi(y)

y0=y;
y_s=1;
while(y(y_s)==0)
    y_s=y_s+1;
end
y_e=length(y);
while(y(y_e)==0)
    y_e=y_e-1;
end
y1=y(y_s:y_e);
x1=find(y1~=0);
y2=interp1(x1,y1(x1),1:length(y1),'linear');
y0(y_s:y_e)=y2;

end



0 0
原创粉丝点击