gauss forward interpolation method

8 ビュー (過去 30 日間)
PJS KUMAR
PJS KUMAR 2018 年 10 月 18 日
編集済み: Torsten 2018 年 10 月 18 日
I wrote the following code for gauss interpolation
function [ yval ] = gauss_p( xd,yd,xp )
n=length(xd);
if(length(yd)==n)
tbl=yd';
for j=2:n
for i=1:n-j+1
tbl(i,j)=tbl(i+1,j-1)-tbl(i,j-1);
end
end
tbl
h=xd(2)-xd(1);
if rem(n,2)==0
k=n/2+1;
else
k=n/2+0.5;
end
p=(xp-xd(k))/h
pt=cumprod([1,p-(0:n-3)])
dt=[tbl(k,1) tbl(k,2) tbl(k-1,3)+tbl(k-1,4) tbl(k-1,4)+tbl(k-1,5) tbl(k-1,5)+tbl(k-1,6) tbl(k-1,6)+tbl(k-1,7)]./factorial(0:n-2)
yval=sum(pt.*dt)
end
Suggest me to simplify the calculation of 'dt' vector subject to 'n' values

回答 (1 件)

Torsten
Torsten 2018 年 10 月 18 日
編集済み: Torsten 2018 年 10 月 18 日
dt = [tbl(k,1), tbl(k,2), tbl(k-1,3:n-1)-tbl(k-1,4:n)]./factorial(0:n-2)
?
Best wishes
Torsten.

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by