当前位置:网站首页>matlab二分法例题(用二分法求零点例题)
matlab二分法例题(用二分法求零点例题)
2022-07-27 11:35:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
matlab二分法小题
方程y=sinx在区间[-1,2]有唯一实根,若用二分法求根,并要求误差不得超过10^6,需要多少次二分?
tol=0.000001;%容差 a=-1;%输入两个端点值 b=2; ya=feval(@f,a);%把a赋给ya yb=feval(@f,b); max=round((log(b-a)-log(tol))/log(2))%最大迭代次数 if yayb>0 fprintf(“二分法不适用”) else for k=1:max%循环 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(“结果为:%f”,(a+b)/2);%该步位置不同,会使循环次数不同 end function [y]=f(x) y=sin(x); end
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/128198.html原文链接:https://javaforall.cn
边栏推荐
- 新版数据仓库的同步使用参考(新手向)
- 1. Introduction and basic use of flume
- Detailed explanation of MATLAB S-function
- Sword finger offer notes: T53 - ii Missing numbers from 0 to n-1
- Leetcode 03: t58. Length of the last word (simple); Sword finger offer 05. replace spaces (simple); Sword finger offer 58 - ii Rotate string left (simple)
- go入门篇 (4)
- 【机器学习-白板推导系列】学习笔记---条件随机场
- Difference quotient approximation of wechat quotient
- Shell script text three swordsmen sed
- 剑指 Offer 笔记: T45. 把数组排成最小的数
猜你喜欢

shell编程之免交互

Matlab draws Bode diagram with time delay system

Keil MDK compilation appears..\user\stm32f10x H (428): error: # 67: expected a "}" wrong solution

Principle of PWM and generation of PWM wave

Tlc549proteus simulation &sallen key filter &ad736vrms to DC conversion &proteus view 51 register value

NPM step pit

箱型图介绍

Wilcoxon rank sum and signed rank

Adobe audit prompts that the sampling rate of audio input does not match the output device - problem solving

Shell script text three swordsman awk
随机推荐
Firewall firewall
JS-寄生组合式继承
广东财政多举措助力稳住粮食安全“压舱石”
【机器学习-白板推导系列】学习笔记---支持向量机和主成分分析法
compute_class_weight() takes 1 positional argument but 3 were given
剑指 Offer 笔记: T57 - II. 和为 s 的连续正数序列
Sword finger offer notes: t57 - I. and two numbers of S
LeetCode 04: T26. 删除排序数组中的重复项(简单); 剑指 Offer 67. 把字符串转换成整数(中等); 面试题 01.08. 零矩阵 (简单)
MATLAB画带延时系统的伯德图
Vscode removes style / syntax highlighting / code highlighting / black background when copying code
Proteus8专业版破解后用数码管闪退的解决
基于反馈率的控制系统原理
NewTicker使用
Sword finger offer note: t45. arrange the array into the smallest number
[unity entry program] creator kitfps: first person shooting 3D game
kazoo使用教程
Pytorch shows the summary like tensorflow
EfficientNet
LAN SDN technology hard core insider 13 from LAN to Internet
Principle of control system based on feedback rate