二分法、试位法、不动点迭代法、牛顿法、割线法 | 您所在的位置:网站首页 › 二分法的基本思想有哪些 › 二分法、试位法、不动点迭代法、牛顿法、割线法 |
二分法、试位法、不动点迭代法、牛顿法、割线法
问题回顾问题分析1.二分法2.试位法3.不动点迭代4.Newton-Raphson法5.割线法小结
问题回顾
一段质量均匀分布的电缆线悬挂在两点之间,构成一段悬链,其满足如下微分方程: 首先确定有根区间,将区间二等分,通过判断f(x)的符号,逐步将有根区间缩小,直至有根区间足够地小,便可求出满足精度要求的近似根。通过悬链最低点张力的唯一性,可以确定该区间只有一个根。 用 (xl,xr)来表示我们所感兴趣的根,初始为(1000,1500),MATLAB脚本程序如下,保留10位有效数字。 clear; x_l = 1000; % the initial value of the left bound of x is 1000 x_r = 1500; % the initial value of the right bound of x is 15000 x_m = mean([x_l,x_r]); % x_m is the mean value of the two bounds x_g = 0; % x_g is the target value of the Bolzano method e_a = 5e-11; i = 0; if f(x_l)*f(x_r)>0 error('invalid input'); else while (abs(x_g-x_m)/x_m>e_a) % tolerance of accuracy if f(x_m)==0 % find the accurate root break; else if f(x_l)*f(x_m)e_a) x_t=x_c; % update the target value with the cross point if f(x_t)==0 break; else x_c = x_r - f(x_r)*(x_l-x_r)/(f(x_l)-f(x_r)); if f(x_c)*f(x_r) |
CopyRight 2018-2019 实验室设备网 版权所有 |