Gauss forward interpolation formula

n = length(x)
I created the difference table (tbl) using the following code. difference table is in attached file
tbl=y';
for j=2:n
for i=1:n-j+1
tbl(i,j)=tbl(i+1,j-1)-tbl(i,j-1);
end
end
p = (xp – x0) / h
yp = y0 + p.dy0 + p(p-1) (d2 y-1 + d3 y-1 ) / 2! + p(p-1) (p-2) (d3 y-1 + d4 y-1 ) / 3! +
p(p-1) (p-2)(p-3) (d4 y-1 + d5 y-1 ) / 4! + p(p-1) (p-2)(p-3)(p-4) (d5 y-1 + d6 y-1 ) / 5!
I created a vector with the terms 1, p, p(p-1), p(p-1)(p-2)…p(p-1)(p-2)..(p-(n-2)) as t=cumprod([1,p-(0:n-2)]);
Now, suggest me the code to create a vector with the following terms
y0 , dy0 , (d2 y-1 + d3 y-1 ) / 2! , (d3 y-1 + d4 y-1 ) / 3! , (d4 y-1 + d5 y-1 ) / 4! ,
(d5 y-1 + d6 y-1 ) / 5! , …….

4 件のコメント

John D'Errico
John D'Errico 2018 年 10 月 17 日
Since this is your homework, why not make an effort? Try it, THEN ask for help in fixing what you tried. You learn nothing by just giving up and asking for someone to provide the answer.
John D'Errico
John D'Errico 2018 年 10 月 18 日
編集済み: John D'Errico 2018 年 10 月 18 日
Please don't answer your question with an answer that only adds information. Learn how to use comments instead. Answer moved to a comment:
My code is given below:
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 with any predefined function
Anton Gluchshenko
Anton Gluchshenko 2020 年 11 月 18 日
編集済み: Anton Gluchshenko 2020 年 11 月 18 日
Sorry. But It is not your code... or?
Ismail Khan Totakhil
Ismail Khan Totakhil 2021 年 3 月 18 日
Good one sir, can u show me the code of Newton backwards interpolation... Thank u sir..

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeInterpolation についてさらに検索

質問済み:

2018 年 10 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by