quadratic.m

来自「hi i have a huge collection are you int」· M 代码 · 共 19 行

M
19
字号
function x = quadratic(a,b,c)% QUADRATIC Find roots of a quadratic equation.%% X = QUADRATIC(A,B,C) returns the two roots of the quadratic equation%%                   y = A*x^2 + B*x + C.  %% The roots are contained in X = [X1 X2].% A. Knight, July 1997delta = 4*a*c;denom = 2*a;rootdisc = sqrt(b.^2 - delta); % Square root of the discriminantx1 = (-b + rootdisc)./denom; x2 = (-b - rootdisc)./denom;x = [x1 x2];

⌨️ 快捷键说明

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