资源预览内容
第1页 / 共5页
第2页 / 共5页
第3页 / 共5页
第4页 / 共5页
第5页 / 共5页
亲,该文档总共5页全部预览完了,如果喜欢就下载吧!
资源描述
解非线性方程组题目2:用数值法求非线性方程组程序流程图开始:定义函数y1(a,b)求出雅克比矩阵给函数一个任意初值计算得出结果的结果与给定的误差精度比较根据误差调整初值 大于给定误差 小于给定误差输出结果 结束子程序y1function y=y1(a,b)% y1(a,b) is a function;% y=y1(a,b)% x1 is variable;% x2 is variable;% a is constant;% b is constant;x1=a;x2=b;y=127627/126743*x2*exp(-x1)-127627*exp(-x1)-x2+127627;129988/126743*x2*exp(-4*x1)-129988*exp(-4*x1)-x2+129988;子程序y11function y=y11(a,b)% y11(a,b) is a function% y=y11(a,b)% x1 is variable% x2 is variable% a is constant% b is constantx1=a;x2=b;y=(-127627/126743)*x2*exp(-x1)+127627*exp(-x1);子程序y12function y=y12(a,b)% y12(a,b) is a function% y=y12(a,b)% x1 is variable% x2 is variable% a is constant% b is constantx1=a;x2=b;y=127627/126743*exp(-x1)-1;子程序y21function y=y21(a,b)% y21(a,b) is a function% y=y21(a,b)% x1 is variable% x2 is variable% a is constant% b is constantx1=a;x2=b;y=(-4*129988/126743)*x2*exp(-4*x1)+4*129988*exp(-4*x1);子程序y22function y=y22(a,b)% y22(a,b) is a function% y=y22(a,b)% x1 is variable% x2 is variable% a is constant% b is constantx1=a;x2=b;y=129988/126743*exp(-4*x1)-1;子程序yJfunction y=yJ(a,b)% yJ(x1,x2) is a function% y=yJ(a,b)% x1 is variable% x2 is variable% a is constant% b is constant% A is matrixx1=a;x2=b;y=y11(x1,x2) y12(x1,x2);y21(x1,x2) y22(x1,x2);子程序yJxxfzzfunction y=yJxxfzz(a,b)% yJxxfzz(x1,x2) is a function% y=yJxxfzz(a,b)% x1 is variable% x2 is variable% a is constant% b is constantx1=a;x2=b;y=-yJ(x1,x2)y1(x1,x2);子程序yyzfunction y=yyz(a,b)% yyz(x1,x2) is a function% y=yyz(a,b)% x1 is variable% x2 is variable% a is constant% b is constant% A1 is matrixx1=a;x2=b;A1=x1;x2;y=A1+yJxxfzz(x1,x2);子程序yJdfunction y=yJd(a,b)% yJd(x1,x2) is a function% y=yJd(a,b)% x1 is variable% x2 is variable% a is constant% b is constant% A1 is matrix% A2 is matrixx1=a;x2=b;error=0.1;while error0.000015 A1=yyz(x1,x2); A2=yJxxfzz(x1,x2); error=abs(A2(1,1) x1=A1(1,1); x2=A1(2,1);end y=A1;
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号