学习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 ...
随机推荐
- Linux安装rz/sz,htop插件
Linux下rz/sz安装及使用方法 sz: 将选定的文件发送(send)到本地机器; rz:运行该命令会弹出 一个文件选择窗口, 从本地选择文件上传到服务器(receive). 下载安装包 lrzs ...
- shell :将标准输出及标准错误输出写到指定文件
shell 脚本如下: logFile=/usr/local/log/$today.txt exec >> $logFile 2>&1 1为标准输出stdout.2为标准错误 ...
- shell脚本(一)
shell脚本(一) 定义:脚本就是一条条命令的堆积.常见脚本有:js asp,jsp,php,python Shell特点:简单易用高效 Shell分类:图形界面(gui shell) 命令行界面 ...
- android 开发 View _16 自定义计步器View、自定义柱状图View
/** *@content:实现计步的环形View *@time:2018-7-30 *@build: */ public class CountStepsAnnularView extends Vi ...
- 20165205 2017-2018-2 《Java程序设计》课程总结
20165205 2017-2018-2<Java程序设计>课程总结 每周作业链接总结 预备作业一: 简述了我认为好的师生关系,展望了未来学习java的日子 预备作业二:总结了C语言的学习 ...
- leetcode448
public class Solution { public IList<int> FindDisappearedNumbers(int[] nums) { Dictionary<i ...
- VUE - 相对路径
background-image背景图片路径问题可以这样解决:1.先在data里面导入这张图片,例如: bg:require('./openIndexBG2.jpg')2 ...
- html 跳转页面传参、点击获取DOM参数
虽然现在前端框架已经很多,尤其是几大流行框架,比如Vue,React,Angular 等,已经去DOM化,但是还是有很多公司仍在使用 HTML + CSS + JS . 这里记载一下用到的HTML传参 ...
- SVG绘制太极图
思路:先画一整个圆,填充颜色为黑色,再用一个边框和填充颜色均为白色的长方形覆盖右半边的半圆,再以同一个圆心,相同半径绘制一整个圆,该圆的边线颜色为黑色,没有填充颜色,最后常规操作再画四个小圆 源代码: ...
- Lua 和 C++ 交互
step1.搭建好vs和lua相交互的环境: 1.下载一个lua5.3的源码: 2.有Lua_lib.lib这个文件: 3.开始配置: 鼠标放在工程名那: 右键选属性: 把包含目录点开进行编辑: 地址 ...