Matlab-2:二分法工具箱
function g=dichotomy(f,tol)
%this routine uses bisection to find a zero of user-supplied
%continuous function f.the user must supply two points an and bn
%such that f(an) and f(bn) have different signs .the user also
%supplies a convergence tolerance delta .
%this progress is writen by H.D.dong
% tic;
% clear
% clc
% f=inline('x^3-x^2-1');
% f=inline('x^6-x-1');
% f=inline('x^2+1');
% % h=inline('x^3-x^2-1');
% % tol=1e-14;
% % Provides a zero-point presence interval
% % %
% % an=1;
% % bn=2;
% % %
% % root=dichotomy(h,tol)
an=1;
bn=2;
root=0;
if f(an)==0,root=an;bn=root;return;
elseif f(bn)==0,root=bn;an=root;return;
elseif sign(f(an))==sign(f(bn)),fprintf('There is no solution in this equation!');
%%
%Above showed:there have considered that we have found the root in the first step.
else
k=0;
while (bn-an)>=tol
midpoint=(bn+an)/2;k=k+1;F(k)=f(midpoint);
if f(midpoint)==0,root=midpoint;an=root;bn=root;break;
elseif sign(f(midpoint))~=sign(f(an)),bn=midpoint;
else
an=midpoint;
end
end
root=(bn+an)/2;
end
g=root;
% toc;
Matlab-2:二分法工具箱的更多相关文章
- 相机标定简介与MatLab相机标定工具箱的使用(未涉及原理公式推导)
相机标定 一.相机标定的目的 确定空间物体表面某点的三维几何位置与其在图像中对应点之间的相互关系,建立摄像机成像的几何模型,这些几何模型参数就是摄像机参数. 二.通用摄像机模型 世界坐标系.摄像机坐标 ...
- matlab添加M_map工具箱(转 http://blog.sina.com.cn/s/blog_491b86bf0100srt9.html)
之前转载过matlab画世界地图的博文.最近正好用到.首先试了matlab自带的worldmap,感觉画出来的图形不尽如人意,比较杂乱.如下图. 略查阅了些资料,请教了Liangjing,一致推荐m_ ...
- Matlab计算机视觉/图像处理工具箱推荐
Matlab计算机视觉/图像处理工具箱推荐 转载http://cvnote.info/matlab-cv-ip-toolbox/ 计算机视觉/图像处理研究中经常要用到Matlab,虽然其自带了图像处理 ...
- Matlab小波工具箱的使用2
Matlab小波工具箱的使用2 (2011-11-11 09:32:57) 转载▼ http://blog.sina.com.cn/s/blog_6163bdeb0102dw7a.html#cmt_5 ...
- matlab 小波工具箱
wavemenu --- >wavelet ---->wavelet packet1-D Matlab小波工具箱的使用1 转载▼ http://blog.sina.com.cn/s/blo ...
- MATLAB用二分法、不动点迭代法及Newton迭代(切线)法求非线性方程的根
MATLAB用二分法.不动点迭代法及Newton迭代(切线)法求非线性方程的根 作者:凯鲁嘎吉 - 博客园http://www.cnblogs.com/kailugaji/ 一.实验原理 二.实验步骤 ...
- 【图像】Matlab图像标定工具箱
参考教程: Matlab工具箱教程 http://www.vision.caltech.edu/bouguetj/calib_doc/ 摄像机模型 http://oliver.zheng.blog ...
- Matlab的曲线拟合工具箱CFtool使用简介
http://phylab.fudan.edu.cn/doku.php?id=howtos:matlab:mt1-5 一. 单一变量的曲线逼近Matlab有一个功能强大的曲线拟合工具箱 cftool ...
- paper 75:使用MATLAB的神经网络工具箱创建神经网络
% 生成训练样本集 clear all; clc; P=[110 0.807 240 0.2 15 1 18 2 1.5; 110 2.865 240 0.1 15 2 12 1 2; 110 2.5 ...
- matlab中gatbx工具箱的添加
1. 从http://crystalgate.shef.ac.uk/code/下载工具箱压缩包gatbx.zip 2. 解压gatbx.zip,将其子文件夹genetic放在matlab安装目录too ...
随机推荐
- LOJ6283 数列分块入门7(分块)
pushdown的addtag[x]打成addtag[i],结果WA了一次 #include <cstdio> #include <algorithm> #include &l ...
- (zhuan) How to Train Neural Networks With Backpropagation
this blog from: http://blog.demofox.org/2017/03/09/how-to-train-neural-networks-with-backpropagation ...
- [thymeleaf] - 1.Thymeleaf是什么
Thymeleaf是⾯向Web和独⽴环境的现代服务器端Java模板引擎,能够处 理HTML,XML,JavaScript,CSS甚⾄纯⽂本. Thymeleaf旨在提供⼀个优雅的.⾼度可维护的创建模板 ...
- jsp的九大内置对象及作用
内置对象名 类型 request HttpServletRequest ...
- Google advertiser api开发概述——部分失败
部分失败 某些 AdWords 服务允许您请求执行有效操作,而对失败的操作返回错误.此功能(称为部分失败)允许您在结束时单独处理失败的操作. 技术细节 要使用此功能,您需要设置此可选的 SOAP 标头 ...
- Installation Guide of Ubuntu 14.04, 64bit on Dell Server
Installation Guide of Ubuntu 14.04, 64bit on Dell Server 准备:U盘(已通过ultraiso刻录ISO镜像). 1.插入U盘: 2.启动服务器, ...
- HDU 5445 Food Problem(多重背包+二进制优化)
http://acm.hdu.edu.cn/showproblem.php?pid=5445 题意:现在你要为运动会提供食物,总共需要提供P能量的食物,现在有n种食物,每种食物能提供 t 能量,体积为 ...
- C#:CsvReader读取.CSV文件(转换成DataTable)
原文引用:https://www.codeproject.com/Articles/9258/A-Fast-CSV-Reader using LumenWorks.Framework.IO.Csv; ...
- animate.css –齐全的CSS3动画库--- 学习笔记
animate.css – 齐全的CSS3动画库 学习网站: https://daneden.github.io/animate.css/ http://www.dowebok.com/98.html ...
- Java 通过get post 请求url
1️⃣.已获取小程序的access_token 为例,通过Get请求url import com.alibaba.fastjson.JSONObject; String wechatUrl = &qu ...