payoff_years.m

来自「nonlinear eq routines in matlab」· M 代码 · 共 24 行

M
24
字号
function varargout = payoff_years(x)%% %%  [y]    = payoff_years(x)%  [y,yp] = payoff_years(x)  returns the function value in y and %                            the derivative in yp%%  Matthias Heinkenschloss%  Department of Computational and Applied Mathematics%  Rice University%  April 17, 2001%a = 100000;p = 10000;r = 0.06;% return the function valuevarargout{1} = a*(1+r).^x - p*((1+r).^x-1)./r;if( nargout > 1 )  % return the derivative as the second argument  varargout{2} = a*(1+r).^x.*log(1+r) - p.*log(1+r)*(1+r).^x./r;end

⌨️ 快捷键说明

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