学习newton raphson and back eluer
% % 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的更多相关文章
- Jacobian矩阵、Hessian矩阵和Newton's method
在寻找极大极小值的过程中,有一个经典的算法叫做Newton's method,在学习Newton's method的过程中,会引入两个矩阵,使得理解的难度增大,下面就对这个问题进行描述. 1, Jac ...
- Newton's method Drawback and advantage
Newton Raphson Method: Advantages and Drawbacks: v=QwyjgmqbR9s" target="_blank"& ...
- Boosting(提升方法)之GBDT
一.GBDT的通俗理解 提升方法采用的是加法模型和前向分步算法来解决分类和回归问题,而以决策树作为基函数的提升方法称为提升树(boosting tree).GBDT(Gradient Boosting ...
- C++函数式编程实现牛顿法
In numerical analysis, Newton's method (also known as the Newton–Raphson method), named after Isaac ...
- Generalized normal distribution and Skew normal distribution
Density Function The Generalized Gaussian density has the following form: where (rho) is the " ...
- Tree - XGBoost with parameter description
In the previous post, we talk about a very popular Boosting algorithm - Gradient Boosting Decision T ...
- 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 ...
- OpenCASCADE解非线性方程组
OpenCASCADE解非线性方程组 eryar@163.com Abstract. 在科学技术领域里常常提出求解非线性方程组的问题,例如,用非线性函数拟合实验数据问题.非线性网络问题.几何上的曲线曲 ...
- 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 ...
随机推荐
- psi
purchase 采购sales 销售inventory 库存 outstock/instock/inventory taking outstock/instock/inventory 出库 入库 盘 ...
- Vue 重点 必须要记住的
基础知识: vue的生命周期: beforeCreate/created. beforeMount/mounted. beforeUpdate/updated. beforeDestory/desto ...
- day28元类与异常查找
元类与异常处理1. 什么是异常处理 异常是错误发生的信号,一旦程序出错就会产生一个异常,如果该异常 没有被应用程序处理,那么该异常就会抛出来,程序的执行也随之终止 异常包含三个部分: ...
- Tomcat 配置详解和优化
2018年01月09日 18:14:41 tianxiaojun2014 阅读数:306 转自:https://www.cnblogs.com/xbq8080/p/6417671.html htt ...
- spring 生命周期最详解
转载. https://blog.csdn.net/qq_23473123/article/details/76610052 目的 在大三开始学习spring时,老师就说spring bean周期非常 ...
- QTP 学习 - 对象库
QTP的关键字视图和专家视图 1.Keyword view(关键字视图) 在录制脚本的过程中,用户执行的每一个步骤,在关键字视图中记录为一行. 关键字视图直观有效,用户可以很清楚的看到被录制对象的录制 ...
- JRebel 代理激活
1.生成GUID https://www.guidgen.com/ 例:04cfff79-8f45-481c-a858-a5b9590422e7 2.License Server 例: http: ...
- JavaScript倒计时实现
/** * 倒计时函数 * @param {String}} endTime 终止时间戳 */ const countDown = (endTime, callback) => { const ...
- python 关于文件夹的操作
在python中,文件夹的操作主要是利用os模块来实现的, 其中关于文件夹的方法为:os.lister() , os.path.join() , os.path.isdir() # path 表示文 ...
- 写出良好风格的JS、CSS代码
现在代码的格式都有 eslint.prettier.babel 这些来保证,但是技术手段再高端都不能解决代码可读性的问题. 因为这个只有个人才能解决.但是注意一下事项,可以显著提高代码的可读性.可识别 ...