% % 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. Java备份文件

    文件名后面补时间: public static void initFile(String sPath) { SimpleDateFormat df = new SimpleDateFormat(&qu ...

  2. python中建模分析零息票收益率曲线--复利和连续复利

    收益率曲线(Yield Curve)是显示一组货币和信贷风险均相同,但期限不同的债券或其他金融工具收益率的图表.纵轴代表收益率,横轴则是距离到期的时间.在此用python建模分析零息票收益率曲线,输出 ...

  3. Ubutu16.04+Cuda9.2/9.0+Cudnn7.12/7.05+TensorFlow-gpu-1.8/1.6

    目录 Ubuntu16.04 Installl 1. 安装环节 2. 安装卡死 3. NVIDIA显卡安装 2. CUDA Install 3.Cudnn7.05 Install 4.Tensorfl ...

  4. TensorFlow NormLization

    local_response_normalization local_response_normalization出现在论文”ImageNet Classification with deep Con ...

  5. win7、centos7 双系统安装总结

    centos7安装过程 问题:TroubleShooting选项进入图形化界面安装才成功. win7恢复引导区 问题:安装完Centos后,win7的引导区不见了 具体恢复过程:http://www. ...

  6. 直接从硬盘安装centos7网址整理

    1.https://blog.csdn.net/happy_joker/article/details/52822025 注意:(1)第3步-->Linux引导安装-->软件选择--> ...

  7. matlab中变量问题——readonly 索引超出矩阵维度 workspacefunc 215

    matlab程序运行过程中会出现如上提示,在网上检索未果,键入dbstop if error语句也无法定错误之处,就想这个错误不是一般的错误. 通过间隔打断点的方式最后定位错误为一句exist = f ...

  8. 配置远程主机http服务器 打包资源

    <1> 搭建nginx  验证nginx是否启动成功 https://blog.csdn.net/wdsdsdsds/article/details/51179780 https://ww ...

  9. phpcms的一些问题 乱码,安装

    一.乱码:我这的网站出现的乱码情况:后台栏目名乱码,迁站后更新缓存,再更新栏目,内容,前台都乱码. 找了半天原因,经过本地测试,没问题,一上线就出现问题,不同点就是线上的数据库版本是mysql5.5, ...

  10. C++重写(覆盖)、重载、重定义、

    总结: 重写(覆盖)override 是指派生类函数重写(覆盖)基类函数 不同的范围,分别位于基类和派生类中 函数的名字相同 参数相同 基类函数必须有virtual关键字 重载overload 成员函 ...