学习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 ...
随机推荐
- python3之time、datetime、random
UTC:协调世界时,又称世界统一时间.世界标准时间.国际协调时间.由于英文(CUT)和法文(TUC)的缩写不同,作为妥协,简称UTC. 中国属于东八区,领先世界时间8小时 time模块 time.ti ...
- WOW
WOW http://bbs.ngacn.cc/read.php?tid=4992959 http://ngasave.us/popcn/?t=gems 地精科技:国服最流行 http://bbs ...
- linux 僵尸进程查看方式
ps -A -ostat,ppid,pid,cmd |grep -e '^[Zz]' # 结果 Z 169925 49893 [sw] <defunct> Z 169925 120690 ...
- Swift 通过运行时获取属性名列表
import UIKit //必须要有@objcMembers修饰符,否则获取到的成员属性为0 @objcMembers class Person: NSObject { var name: Stri ...
- push() 方法将一个或多个元素添加到数组的末尾,并返回新数组的长度
var numbers = [1, 2, 3]; numbers.push(4); console.log(numbers); // [1, 2, 3, 4] numbers.push(5, 6, 7 ...
- MySQL的show profile(已过时)简介以及该功能在MySQL 5.7中performance_schema中的替代
本文出处:http://www.cnblogs.com/wy123/p/6979499.html show profile 命令用于跟踪执行过的sql语句的资源消耗信息,可以帮助查看sql语句的执行情 ...
- jquery中的 deferred之 deferred对象 (一)
案例: var def=$.Deferred(); console.log(def);//答案见 图1 图1: deferred就是一个有这些方法的对象. 看源码分析: Deferred: funct ...
- 洛谷P1169 棋盘制作(悬线法)
题目链接:https://www.luogu.org/problemnew/show/P1169 #include<bits/stdc++.h> #define fi first #def ...
- java学习笔记(四):import语法
Import 语法是给编译器寻找特定类的适当位置的一种方法. 创建一个Employee 类,包括四个实体变量姓名(name),年龄(age),职位(designation)和薪水(salary). p ...
- java程序的三种结构
从结构化程序设计角度出发,程序有三种结构: 顺序结构: JAVA的基本结构就是顺序结构,除非特别指明,否则就按照顺序一句一句执行顺序结构是最简单的算法结构,语句与语句之间,框与框之间是按从上到下的 ...