当前位置:网站首页>Example of MATLAB dichotomy (example of finding zero point by dichotomy)
Example of MATLAB dichotomy (example of finding zero point by dichotomy)
2022-07-27 12:04:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
matlab Dichotomy topic
equation y=sinx In the interval [-1,2] Has a unique real root , If you use dichotomy to find the root , And the error shall not exceed 10^6, How many times do you need two points ?
tol=0.000001;% tolerance a=-1;% Enter two endpoint values b=2; ya=feval(@f,a);% hold a Assign to ya yb=feval(@f,b); max=round((log(b-a)-log(tol))/log(2))% Maximum number of iterations if yayb>0 fprintf(“ Dichotomy does not apply ”) else for k=1:max% loop c=(a+b)/2 yc=feval(@f,c); if yc==0 b=c; a=c; elseif ycyb>0 b=c; else a=c; end err(k)=b-a; if err(k)<tol break end end fprintf(“ The result is :%f”,(a+b)/2);% The position of this step is different , Will make the number of cycles different end function [y]=f(x) y=sin(x); end
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/128198.html Link to the original text :https://javaforall.cn
边栏推荐
- Leetcode 04: T26. Delete duplicate items in the sorting array (simple); Sword finger offer 67. convert the string to an integer (medium); Interview question 01.08. zero matrix (simple)
- Sword finger offer note: t45. arrange the array into the smallest number
- Unexpected harvest of epic distributed resources, from basic to advanced are full of dry goods, big guys are strong!
- Synchronous use reference of the new version of data warehouse (for beginners)
- Keil MDK编译出现..\USER\stm32f10x.h(428): error: #67: expected a “}“错误的解决办法
- Beyond compare 3 next difference segment / down search arrow not found
- Greek alphabet reading
- Sword finger offer note: T39. Numbers that appear more than half of the time in the array
- Matlab S-function详解
- STS download tutorial (the solution cannot be downloaded on the include official website)
猜你喜欢

Iptables firewall
Unexpected harvest of epic distributed resources, from basic to advanced are full of dry goods, big guys are strong!

shell编程之免交互

Can you really write binary search - variant binary search

阿里云云数据库RDS版Exception during pool initialization

【机器学习-白板推导系列】学习笔记---支持向量机和主成分分析法

PWM的原理和PWM波的产生

How to make a graph? Multiple subgraphs in a graph are histogram (or other graphs)

Proteus8专业版破解后用数码管闪退的解决

【无标题】多模态模型 CLIP
随机推荐
TapNet: Multivariate Time Series Classification with Attentional Prototypical Network
[machine learning whiteboard derivation series] learning notes --- conditional random fields
[untitled] multimodal model clip
compute_class_weight() takes 1 positional argument but 3 were given
kazoo使用教程
【无标题】多模态模型 CLIP
Matlab draws Bode diagram with time delay system
The chess robot "broke" the chess boy's finger...
CH340模块无法识别/烧写不进的一种可能性
Temporary use of solo, difficult choice of Blog
How to make a graph? Multiple subgraphs in a graph are histogram (or other graphs)
mysql分页查询实例_mysql分页查询实例讲解「建议收藏」
你尚未连接代理服务器可能有问题或地址不正确(如何查看代理服务器ip)
基于反馈率的控制系统原理
SMA TE: Semi-Supervised Spatio-Temporal RepresentationLearning on Multivariate Time Series
暂用 Solo,博客选择困难
孤独的年轻人,戒不了Jellycat
A possibility that ch340 module cannot be recognized / burned
关于离线缓存Application Cache /使用 manifest文件缓存
Could not load dynamic library ‘libcudnn.so.8‘;