% A smoothed differentiation filter (digital differentiator).
% Such a filter has the following advantages:
% First, the filter involves both the smoothing operation and differentation operation.
% It can be regarded as a low-pass differention filter (digital differentiator).
% It is well known that the common differentiation operation amplifies the high-frequency noises.
% Therefore, the smoothded differentiation filter would be valuable in experimental (noisy) data processing.
% Secondly, the filter coefficients are all convenient integers (simple units) except for an integer scaling factor,
% as may be especially significant in some applications such as those in some single-chip microcomputers
% or digital signal processors.
% n: filter length (positive integer larger no less than 2)
% h: filter coefficients (anti-symmetry)
% Jianwen Luo <firstname.lastname@example.org, email@example.com> 2004-11-02
% Department of Biomedical Engineering, Department of Electrical Engineering
% Tsinghua University, Beijing 100084, P. R. China
% Usui, S.; Amidror, I.,
% Digital Low-Pass Differentiation for Biological Signal-Processing.
% IEEE Transactions on Biomedical Engineering 1982, 29, (10), 686-693.
% Luo, J. W.; Bai, J.; He, P.; Ying, K.,
% Axial strain calculation using a low-pass digital differentiator in ultrasound elastography.
% IEEE Transactions on Ultrasonics Ferroelectrics and Frequency Control 2004, 51, (9), 1119-1127.
if n>=2 && floor(n)==ceil(n)
if mod(n,2)==1%is odd
h=[-ones(1,m) 0 ones(1,m)]/m/(m+1);
error('The input parameter (n) should be a positive integer larger no less than 2.');