📄 non_linear_roots.m
字号:
function non_linear_roots(fun, x0)
tol = 1e-6;
syms x;
it = 0;
x = x0 + tol + tol;
while abs(x - x0) > tol
it = it + 1;
if (it > 10000) || (x == Inf) || (x == -Inf) || (x == NaN)
fun
disp('Iteration Failed.');
return;
end
x0 = x;
x = subs(fun, x);
end
fun
x
it, disp('Iteration Success.');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -