用MATLAB编程计算牛顿差商表,下面这个程序怎么都不对,> x=[0.40,0.55,0.65,0.80,0.90,1.05];y=[0.41075,0.57815,0.69675,0.88811,1.02652,1.25382];n=length(x);newton=[x',y'];for j=2:nfor i=n:1if i>=jy(i)=(y(i)-y(i-1))/(x(i)-x(i-j-1))else
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 20:39:21
用MATLAB编程计算牛顿差商表,下面这个程序怎么都不对,> x=[0.40,0.55,0.65,0.80,0.90,1.05];y=[0.41075,0.57815,0.69675,0.88811,1.02652,1.25382];n=length(x);newton=[x',y'];for j=2:nfor i=n:1if i>=jy(i)=(y(i)-y(i-1))/(x(i)-x(i-j-1))else
用MATLAB编程计算牛顿差商表,下面这个程序怎么都不对,
> x=[0.40,0.55,0.65,0.80,0.90,1.05];
y=[0.41075,0.57815,0.69675,0.88811,1.02652,1.25382];
n=length(x);
newton=[x',y'];
for j=2:n
for i=n:1
if i>=j
y(i)=(y(i)-y(i-1))/(x(i)-x(i-j-1))
else y(i)=0
end
end
newton=[newton,y'];
end
>> disp('下三角状的牛顿差商表如下:')
用MATLAB编程计算牛顿差商表,下面这个程序怎么都不对,> x=[0.40,0.55,0.65,0.80,0.90,1.05];y=[0.41075,0.57815,0.69675,0.88811,1.02652,1.25382];n=length(x);newton=[x',y'];for j=2:nfor i=n:1if i>=jy(i)=(y(i)-y(i-1))/(x(i)-x(i-j-1))else
程序修改了一下,不知道是不是你想要的结果:
x=[0.40,0.55,0.65,0.80,0.90,1.05];
y=[0.41075,0.57815,0.69675,0.88811,1.02652,1.25382];
n=length(x);
newton=[x',y'];
for j=2:n
for i=n:-1:1
if i>=j
y(i)=(y(i)-y(i-1))/(x(i)-x(i-j+1));
else
y(i)=0;
end
end
newton=[newton,y'];
end
disp('下三角状的牛顿差商表如下:')
newton