【正文】
endfunction [y] = func2_1_1(x)%UNTITLED7 Summary of this function goes here% Detailed explanation goes herey=11/x。 end if func2_1(x1)==0 break end endy=x。 if(abs(x1)) delt=abs(x1x)。endwhile(delt1e6||abs(func2_1(x))1e6) x=x1。if(abs(x1)) delt=abs(x1x)。end選做題二:newton算法function [y] = newton(x)%UNTITLED5 Summary of this function goes here% Detailed explanation goes hereformat long。 end I=T(k+1,k+1)。 for j=1:k T(k+1,j+1)=T(k+1,j)+(T(k+1,j)T(k,j))/(4^j1)。 end T(k+1,1)=T(k,1)/2+h*Q。 for i=1:M x=a+h*(2*i1)。 h=h/2。 T(1,1)=(h/2)*(subs(sym(f),findsym(sym(f)),a)+subs(sym(f),findsym(sym(f)),b))。 T=zeros(1,1)。 tol=10。Ch4(1,[2 3 4])選做題一:Romberg算法function [I,step] = Rg(f,a,b,eps)%UNTITLED4 Summary of this function goes here% Detailed explanation goes here if nargin==3 eps=1e4。Ch2(1,[2 3 4])。 Ah3]Ch4=[Axk39。 Ah1]Ch2=[Axk39。endAxk(i)=xkk(4*i3)。Ah3(i,j)=D(4*i1,j)。 %將迭代得到的結(jié)果及誤差存到矩陣D中for i=1:1:10 %將同一個(gè)步長(zhǎng)下不同X得到的結(jié)果集中到一個(gè)矩陣for j=1:1:3Ah1(i,j)=D(4*i3,j)。 ckk39。endendD=[yxk39。xkk(k)=xk。ckk(k)=ck。 %求出精確值ck=abs(ykyeal)。endyk=ykm。ykm=yk+(k1+2*k2+2*k3+k4)*()。k3=hj*(20*(yk+k2*))。format longk1。 n=n+1。while norm(yx0)=eps x0=y。y=G*x0+f。G=(DL)\U。L=tril(A,1)。 end else end endendfunction [y,n]=gauseidel(A,b,x0,eps)%UNTITLED Summary of this function goes here% Detailed explanation goes hereif nargin==3 eps=1e6