% % time step  https://ww2.mathworks.cn/matlabcentral/answers/184200-newton-raphson-loop-for-backward-euler
% h = (t_final - t_init)/n; % with n number of time steps
% % vectors
% t = [tinit zeros(,n)]; % time
% y = [yinit zeros(,n)]; % solution
% % Backward Euler loop
% for i = :n
% t(i+) = t(i) + h;
% y_temp = y(i) + h(f(t(i), y(i)));
% y(i+) = y(i) + h*f(t(i+), y_temp);
% end
% for i = :n
% error = ;
% tolerance = 1e-;
% t(i+) = t(i) + h;
% y_temp = y(i) + h*(f(t(i), y(i)));
% while error >= tolerance
% y(i+) = y(i) + h*f(t(i+), y_temp);
% error = abs(y(i+) - y_temp) % (local) absolute error
% y_temp = y(i+);
% end
% end % yold = y(i)+h*f(t(i),y(i));
% while error >= tolerance
% ynew = yold-(yold-(y(i)+h*f(t(i+),yold)))/(-h*df(t(i+),yold));
% error = abs(ynew-yold);
% yold=ynew;
% end
% y(i+) = ynew; %y'=y+2*x/y^2 x=[0,2] y(0)=1 https://wenku.baidu.com/view/d18cdaa10b4c2e3f5627632f.html
t_final=;
t_init=;
n=;
tolerance=0.0000001
h = (t_final - t_init)/n;
ti=t_init+h;
yold=+h*f(,);% yold = y(i)+h*f(t(i),y(i));
while error >= tolerance
ynew = yold-(yold-(y(i)+h*f(t(i+),yold)))/(-h*df(t(i+),yold));
error = abs(ynew-yold);
yold=ynew;
end
y(i+) = ynew;

上面代码应该怎样修改?

学习newton raphson and back eluer的更多相关文章

  1. Jacobian矩阵、Hessian矩阵和Newton's method

    在寻找极大极小值的过程中,有一个经典的算法叫做Newton's method,在学习Newton's method的过程中,会引入两个矩阵,使得理解的难度增大,下面就对这个问题进行描述. 1, Jac ...

  2. Newton's method Drawback and advantage

     Newton Raphson Method: Advantages and Drawbacks:   v=QwyjgmqbR9s" target="_blank"& ...

  3. Boosting(提升方法)之GBDT

    一.GBDT的通俗理解 提升方法采用的是加法模型和前向分步算法来解决分类和回归问题,而以决策树作为基函数的提升方法称为提升树(boosting tree).GBDT(Gradient Boosting ...

  4. C++函数式编程实现牛顿法

    In numerical analysis, Newton's method (also known as the Newton–Raphson method), named after Isaac ...

  5. Generalized normal distribution and Skew normal distribution

    Density Function The Generalized Gaussian density has the following form: where  (rho) is the " ...

  6. Tree - XGBoost with parameter description

    In the previous post, we talk about a very popular Boosting algorithm - Gradient Boosting Decision T ...

  7. Tree - Gradient Boosting Machine with sklearn source code

    This is the second post in Boosting algorithm. In the previous post, we go through the earliest Boos ...

  8. OpenCASCADE解非线性方程组

    OpenCASCADE解非线性方程组 eryar@163.com Abstract. 在科学技术领域里常常提出求解非线性方程组的问题,例如,用非线性函数拟合实验数据问题.非线性网络问题.几何上的曲线曲 ...

  9. 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 ...

随机推荐

  1. import 搜索路径

    来源 http://www.runoob.com/python/python-mysql.html 搜索路径 当你导入一个模块,Python 解析器对模块位置的搜索顺序是: 1.当前目录 2.如果不在 ...

  2. vue展示dicom文件,医疗系统。

    环境:vue.webpack.constone 资料来源及文件:https://github.com/GleasonBian/CornerstoneVueWADO 需要下载的模块:cornerston ...

  3. ETL讲解(很详细!!!)

    ETL讲解(很详细!!!) ETL是将业务系统的数据经过抽取.清洗转换之后加载到数据仓库的过程,目的是将企业中的分散.零乱.标准不统一的数据整合到一起,为企业的决策提供分析依据. ETL是BI项目重要 ...

  4. 白话RPC

    RPC,这个英文缩写在计算机专业里的意思是:Remote Procedure Call Protocol,远程过程调用协议,字面上的意思就是这个,不过还是有些懵逼. 下面就简单说明一下其内在原理,形象 ...

  5. [java,2017-05-16] java中清空StringBuffer的方法以及耗费时间比较

    java中清空StringBuffer的方法,我能想到的有4种: 1. buffer.setLength(0);  设置长度为0 2. buffer.delete(0, buffer.length() ...

  6. [java,2017-05-15] 内存回收 (流程、时间、对象、相关算法)

    内存回收的流程 java的垃圾回收分为三个区域新生代.老年代. 永久代 一个对象实例化时 先去看伊甸园有没有足够的空间:如果有 不进行垃圾回收 ,对象直接在伊甸园存储:如果伊甸园内存已满,会进行一次m ...

  7. python:win下将py文件打包成exe

    [环境]windows,正常运行的python文件 1.安装pyinstaller ,cmd下执行以下命令,需看到安装成功界面 pip install pyinstaller 2.cmd中进入要打包的 ...

  8. 6. 添加messager.alert()确定按钮的回调函数,即点完确定按钮后触发的事件

    添加messager.alert()确定按钮的回调函数,即点完确定按钮后触发的事件: $.messager.alert('提示信息', "请联系管理员处理!", 'info', f ...

  9. Python学习笔记---切片 列表 元祖 字典 集合

    列表[1,2,3,2]#[] 元祖(1,2,3,2)#() 字典{1:2,3:2}#{} 集合{1,2,3,2}#{} 1,集合与列表的区别,集合里不能有重复元素 2.字典与集合的区别,都是用花括号表 ...

  10. Http协议和Https协议的安全性问题

    https://www.cnblogs.com/intsmaze/p/6009648.html https://blog.csdn.net/jeffleo/article/details/768630 ...