⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 false_position.m

📁 The False-Position method to solve a linear equation The Bisection method to solve linear equation
💻 M
字号:
%xsin(x) =1;
clear all;
clc;
f = inline('x*sin(x)-1');
fplot(f,[0,2]);
hold on;
grid on;
a=0;
b=2;
plot(a,0,'.g');
plot(b,0,'.r');
for i =1:20;
    c=(a.*f(b)-b*f(a))./(f(b)-f(a));
    if f(a).*f(c)>0
        a=c;
    else
        b=c;
    end
disp([a,b,c]);
plot(a,0,'.g');
plot(b,0,'.r');
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -