solve_diode_equation.m
来自「The Finite Difference Time Domain Method」· M 代码 · 共 15 行
M
15 行
function [x] = solve_diode_equation(A, B, C, x)
% Function used to solve the diode equation
% which is in the form Ae^{Bx}+x+C=0
% using the Newton-Raphson method
tolerance = 1e-25;
max_iter = 50;
iter = 0;
f = A * exp(B*x) + x + C;
while ((iter < max_iter) && (abs(f) > tolerance))
fp = A * B * exp(B*x) + 1;
x = x - f/fp;
f = A * exp(B*x) + x + C;
iter = iter + 1;
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?