No BSD License  

Highlights from
z-transform of 1D & 2D Savitzky-Golay Smoothing and Differentiation Filter

image thumbnail

z-transform of 1D & 2D Savitzky-Golay Smoothing and Differentiation Filter

by

 

02 Nov 2005 (Updated )

z-transform of 1D & 2D Savitzky-Golay Smoothing and Differentiation Filter

ztrans1d(h);
function [A,u] = ztrans1d(h);
% ZTRANS1D Computes the z-transform for the 1D GS-Filters
%
% Usage:
%      [A,u] = ztrans1d(h,txtmsg)
% INPUT:
%          h = Odd-length vector of filter coefffecients
%              usually generated by sgsdf1d.m .
% OUTPUT:
%          A = The Amplitude spectrum of the filter. These filteres
%              are even-functions with zero phase shift.
%          u = +/- Frequency up to Nyquist
%
% See also SGSDF1D, SGSF2D, SGDF2D, ZTRANS1D, ZTRANS2D

% Note: Savitzky-Golay Filter for differentiation and smoothing
%       of 1D & 2D Images.

% ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
% Written by: Dr. A. Abokhodair                           Date: 11/2/2005
% akwahab@kfupm.edu.sa             http://faculty.kfupm.edu.sa/ES/akwahab/
% ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

syms u;
h=h(:);

% Check input
nC = length(h);
if ~isodd(nC)
    error('Length of filter vector is not ODD');
end

N=(nC-1)/2;    
r=(-N:N)';
Z=exp(-i*r*u);
U=ones(size(h));
H=simplify(U'*(h.*Z));
T=vectorize(char(H));
u=pi*(-1:0.025:1)';
T=eval(T);
A=abs(T);
% plot(u/pi,A, 'r'),grid;
% xlabel('Frequency');
% ylabel('Amplitude Spectrum');
% ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

function x = isodd (number)
% isodd(number)
% returns 1 if the number is Odd, 0 if it is even.
a = number/2;
whole = floor(a);
part = a-whole;

if part > 0;
    x = 1;
else
    x = 0;
end
% ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    

Contact us