% Matlab script to illustrate Newton's method
% to solve a nonlinear equation % this particular script finds the square root of a number M
% (input by the user) % note that the function we are trying to zero is f(x) = x^2 - M.
% its derivative is f'(x) = 2*x.
% these functions are hard-coded in the script. format long % get user input
M = input('Please enter the number whose square root you want: ')
x0 = input('Please enter starting guess: ') % iteration counter
k = 1
% compute first Newton iterate to enter loop
x = x0 - (x0^2-M)/(2*x0)
disp('Hit return to continue')
pause while abs(x-x0) > eps*abs(x),
% reset guess to old iterate
x0 = x;
% increment iteration counter
k = k + 1
% compute and display Newton iterate
x = x0 - (x0^2-M)/(2*x0)
disp('Hit return to continue')
pause
end

matlab Newton method的更多相关文章

  1. Apply Newton Method to Find Extrema in OPEN CASCADE

    Apply Newton Method to Find Extrema in OPEN CASCADE eryar@163.com Abstract. In calculus, Newton’s me ...

  2. Matlab Newton‘s method

    定义函数 function y=f(x) y=f(x).%函数f(x)的表达式 end function z=h(x) z=h(x).%函数h(x)的表达式 end 主程序 x=X;%迭代初值 i=0 ...

  3. matlab secant method

    % Matlab script to illustrate the secant method % to solve a nonlinear equation % this particular sc ...

  4. Newton法(牛顿法 Newton Method)

               1.牛顿法应用范围                          牛顿法主要有两个应用方向:1.目标函数最优化求解.例:已知 f(x)的表达形式,,求 ,及g(x)取最小值时 ...

  5. Newton‘ method 的优缺点

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMzE1Mjg5NQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQk ...

  6. <<Numerical Analysis>>笔记

    2ed,  by Timothy Sauer DEFINITION 1.3A solution is correct within p decimal places if the error is l ...

  7. <Numerical Analysis>(by Timothy Sauer) Notes

    2ed,  by Timothy Sauer DEFINITION 1.3A solution is correct within p decimal places if the error is l ...

  8. .NET数据挖掘与机器学习开源框架

    1.    数据挖掘与机器学习开源框架 1.1 框架概述 1.1.1 AForge.NET AForge.NET是一个专门为开发者和研究者基于C#框架设计的,他包括计算机视觉与人工智能,图像处理,神经 ...

  9. 02(c)多元无约束优化问题-牛顿法

    此部分内容接<02(a)多元无约束优化问题>! 第二类:牛顿法(Newton method) \[f({{\mathbf{x}}_{k}}+\mathbf{\delta })\text{ ...

随机推荐

  1. 迅为IMX6开发板适用于HMI|车载电脑|工业控制|医疗仪器|智能家居 灵活进行产品开发平台

    i.MX6开发平台行业中的应用 适用于HMI.POS机.车载电脑.工业控制.轨道交通.医疗仪器.智能家居.数据终端等行业. 迅为iMX6开发板采用核心板+底板结构设计,高品质,稳定性强,可以更灵活地进 ...

  2. 迅为嵌入式4418/6818开发板QT-HDMI显示

    本文转自迅为论坛:http://www.topeetboard.com 平台:迅为4418/6818开发平台 1.首先请确认下光盘资料的日期(只有20171120及以后更新的光盘支持QT HDMI显示 ...

  3. 迅为4412嵌入式安卓开发板兼容3G网络|4G网络

    iTOP-Exynos4412开发板内置有无线 WIFI 模块.Bluetooth.GPS.Camera.3G等模组,陀螺仪等,支持 HDMI1.4(1080P/60Hz)显示,客户可以直接从开发平台 ...

  4. linux远程开机

    它需要wakeonlan这个软件,     从何处得到它?     它的官方站是:http://sourceforge.net/projects/wake-on-lan/     如果使用rpm包可以 ...

  5. 解决dom4j加载xml文件性能慢的问题

    在代码中使用: 1: DocumentHelper.parseText 2: SAXReader reader = new SAXReader(); Document extdocument = re ...

  6. Java 序列化Serializable详解(附详细例子)

    Java 序列化Serializable详解(附详细例子) 1.什么是序列化和反序列化Serialization(序列化)是一种将对象以一连串的字节描述的过程:反序列化deserialization是 ...

  7. Chrome插件:浏览器后台与页面间通信

    content.js 与 background.js和popup.js 通信和 background.js与popup.js  这些通信都用 chrome.runtime.sendMessage 这个 ...

  8. js中事件冒泡和事件捕获

    什么时候存在这种问题? 当一个行为触发了多个对象的事件时.   <body>   <div class="fa">     <div class=&q ...

  9. PHP导出超大的CSV格式的Excel表方案

    场景和痛点 说明 我们工作场景都常会导出相关的excel数据,有时候需要大量的数据,10W,100W都有可能 我们现有方案都是直接利用phpexcel等类库来操作,phpexcel的load加载或是写 ...

  10. Python中关于使用正则表达式相关的部分笔记

    一点点自己记的笔记,如果各位朋友看不懂,可以在评论区留言,会尽可能快的回复. 所有的知识点全部贴在代码上了,注释也写了. 建议大伙把代码拷到自己的机器上,运行,查看结果,然后,结合注释,再自己稍稍理解 ...