Réponse acceptée

mdpexbn
mdpexbn le 22 Mai 2023

0 votes

你这含有未知数x,也不给值,当然没有数值了
clear all
x1 = [0.2 0.4 0.6 0.8 1.0];
y1 = [0.98 0.92 0.81 0.64 0.38];
n = length(y1);
c = y1;
for j = 2 : n
for i = n:-1:j
c(i)=(c(i)-c(i-1))/(x1(i)-x1(i-j+1));
end
end
x = 1;
df(1)=1;
d(1)=y1(1)*df(1);
for i =2:n
df(i) = df(i-1)*(x-x1(i-1));
d(i)=c(i)*(df(i));
end
p4 = vpa(d,5)
plot(x1,double(p4))

Plus de réponses (0)

Catégories

En savoir plus sur 线性代数 dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!