compute_diff.m

来自「张量投票在matlab环境下的仿真。球型张量及棒型张量的仿真」· M 代码 · 共 20 行

M
20
字号
function y = compute_diff(x,order,options)

% compute_diff - compute central derivative (of order 'order') of a vector.
%
% y = compute_diff(x,order,options);
%
%   'options' is a structure:
%   - options.h is the sampling step size (default 1).
%   - options.type is the kind of finite difference.
%       type==1 is for forward differences, ie.
%           y(i) = (x(i+1)-x(i-1))/(2h), with special
%           care at boundaries.
%       type==2 is fwd differences, ie.
%           y(i) = (x(i+1)-x(i))/h, with special
%           care at boundaries.
%       type==2 is fwd differences, ie.
%           y(i) = (x(i)-x(i-1))/h, with special
%           care at boundaries.
%
%   Copyright (c) 2004 Gabriel Peyr

⌨️ 快捷键说明

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