- 阅读权限
- 255
- 威望
- 1 级
- 论坛币
- 49655 个
- 通用积分
- 55.9937
- 学术水平
- 370 点
- 热心指数
- 273 点
- 信用等级
- 335 点
- 经验
- 57805 点
- 帖子
- 4005
- 精华
- 21
- 在线时间
- 582 小时
- 注册时间
- 2005-5-8
- 最后登录
- 2023-11-26
已卖:4900份资源
学术权威
还不是VIP/贵宾
TA的文库 其他... R资源总汇
Panel Data Analysis
Experimental Design
- 威望
- 1 级
- 论坛币
 - 49655 个
- 通用积分
- 55.9937
- 学术水平
- 370 点
- 热心指数
- 273 点
- 信用等级
- 335 点
- 经验
- 57805 点
- 帖子
- 4005
- 精华
- 21
- 在线时间
- 582 小时
- 注册时间
- 2005-5-8
- 最后登录
- 2023-11-26
 | 开心 2017-10-21 10:25:33 |
|---|
签到天数: 1 天 连续签到: 1 天 [LV.1]初来乍到
|
经管之家送您一份
应届毕业生专属福利!
求职就业群
感谢您参与论坛问题回答
经管之家送您两个论坛币!
+2 论坛币
- A MATLAB function fnewton is supplied for Newton’s method. The function that forms
- the left side of the equation we wish to solve and its derivative must be supplied by the
- user as functions; these become the first and second parameters of the function. The third
- parameter is an initial approximation to the root. The convergence criterion used is that
- the difference between successive approximations to the root is less than a small preset
- value. This value must be supplied by the user and is given as the fourth parameter of the
- function.
- function [res, it] = fnewton(func,dfunc,x,tol)
- % Finds a root of f(x) = 0 using Newton
- s method.
- % Example call: [res, it] = fnewton(func,dfunc,x,tol)
- % The user defined function func is the function f(x).
- % The user defined function dfunc is df/dx.
- % x is an initial starting value, tol is required accuracy.
- it = 0; x0 = x;
- d = feval(func,x0)/feval(dfunc,x0);
- while abs(d) > tol
- x1 = x0-d; it = it+1; x0 = x1;
- d = feval(func,x0)/feval(dfunc,x0);
- end
- res = x0;
- We will now find a root of the equation
- x3 􀀀10x2 C29x􀀀20 D 0
- To use Newton’s method we must define the function and its derivative as follows:
- >> f = @(x) x.^3-10*x.^2+29*x-20;
- >> df = @(x) 3*x.^2-20*x+29;
- We may call the function fnewton as follows:
- >> [x,it] = fnewton(f,df,7,0.00005)
- x =
- 5.0000
- it =
- 6
复制代码Reference
- Numerical Methods using Matlab Abhishek Gupta Apress
扫码加我 拉你入群
请注明:姓名-公司-职位
以便审核进群资格,未注明则拒绝
|
|
|