正在加载图片...
图4 图5 2.代码段如下: X=[1:12 Y=[5858585857575758606467681: S=cnsfit(X,Y方 st=0, figure hold on for i=1:11 x=X0.01:X(it1方 y-polyval(S(i:).x-X(i)) plot(x,y) st-st+trapz(x.y). %利用积分中值定理求平均值 end st=st/11 plot(X.Y.) hold off 运行结果如下: 假设Sx)的每 一分段为Sx.0(x-x3+5z1(xxP+52(x53,x∈,x1 S 52 S1(x) -0.0247202591023146 0 0.0247202591023146 S(x)= S()0.123601295511573 -0.0741607773069438-0.0494405182046292 5 x1-0469649220439770206643109227775 0.173041813716202 58 S(x) 0.755138396264337 -1.11241165960416 -0.6427267366601858 图 4 图 5 2. 代码段如下: X=[1:12]; Y=[58 58 58 58 57 57 57 58 60 64 67 68]; S=cnsfit(X,Y); st=0; figure hold on for i=1:11 x=X(i):.01:X(i+1); y=polyval(S(i,:),x-X(i)); plot(x,y) st=st+trapz(x,y); % 利用积分中值定理求平均值 end st=st/11 plot(X,Y,'r.') hold off 运行结果如下: 假设S(x)的每一分段为Si(x)=si,0(x-xi) 3+si,1(x-xi) 2+si,2(x-xi)+si,3, x∈[xi, xi+1]. S(x)= Si(x) si,0 si,1 si,2 si,3 S1(x) -0.0247202591023146 0 0.0247202591023146 58 S2(x) 0.123601295511573 -0.0741607773069438 -0.0494405182046292 58 S3(x) -0.469684922943977 0.296643109227775 0.173041813716202 58 S4(x) 0.755138396264337 -1.11241165960416 -0.64272673666018 58
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有