求解一个多项式绘图订正。

 Accepted Answer

mdpexbn
mdpexbn on 22 May 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))

More Answers (0)

Categories

Find more on 线性代数 in Help Center and File Exchange

Tags

Asked:

on 22 May 2023

Answered:

on 22 May 2023

Community Treasure Hunt

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

Start Hunting!