Code covered by the BSD License
-
myconv(z,h)
MYCONV is a fft accelerated correspondence to
-
myconv2(z,h)
MYCONV2 is a fft accelerated correspondence to
-
myconvper(z,h)
MYCONVPER is a periodical fft accelerated correspondence to
-
myconvper2(z,h)
MYCONVPER2 is a periodical fft accelerated correspondence to
-
myffttrunc(s,n)
MYFFTTRUNC(s,n) returns the low-pass filtered content of the signal s
-
myffttrunc2(s,n,m)
MYFFTTRUNC(s,n) returns the low-pass filtered content of the signal s
-
mygaussian(x,z,varargin)
MYGAUSSIAN makes use of the 1D convolution myconvper to filter the signal
-
mygaussian2(x,y,z,varargin)
MYGAUSSIAN2 makes use of the symmetry of the Gaussian weighting function
-
myxcorr(a,b)
MYXCORR FFT accelerated cross-correlation function estimates.
-
myxcorr2(a,b)
MYXCORR2 Two-dimensional FFT accelerated periodic cross-correlation of
-
View all files
from
FFT accelerated surface analysis tools package
by Andreas Almqvist
FFT accelerated functions for analysing 1D and 2D signals such surface profiles, surfaces and images
|
| myxcorr(a,b) |
function c = myxcorr(a,b)
%MYXCORR FFT accelerated cross-correlation function estimates.
% If A is a N x NA matrix and B is N x NB matrix
% C is a NA+NB-1 matix
%
% If A is a N x NA matrix, then MYXCORR(A) is the auto-correlation
% sequence.
%
% See also CONV, CONV2, XCORR, MYCONV, MYCONV2, MYXCORR2
%
% clear all;
%
% % Create a "measurement" domain
% Lx = 1e-3;
% Nx = 2^15;
% x = Lx*(0:Nx-1)/Nx;
% dx = x(2)-x(1);
%
% % "Sample" the (periodic) signal
% z = cos(2*pi*2*x/Lx)+...
% 0.5*cos(2*pi*5*(x-0.14*Lx)/Lx)+...
% 0.25*cos(2*pi*20*(x-0.3*Lx)/Lx)+...
% 0.25*cos(2*pi*30*(x-0.7*Lx)/Lx);
%
% Nz = length(z);
%
% % Filter weighting function
% lcx = Lx/5; % Cut-off acc to ISO 11562 Gaussian Profile Filter Lx/5
% xf = [x x(end)+dx]-Lx/2; % Symmetric and ensure that Nx+Nh-1 = 2^k
% variancex = 1/(pi*sqrt(2/log(2)))*lcx;
% h = dx/(sqrt(2*pi)*variancex)*...
% exp(-(((xf)/variancex).^2)/2);
% Nh = length(h);
%
% % Total length of the padded arrays needed for the fft operations
% N = Nz+Nh-1;
%
% % Cross correlation - built in function
% tic;
% xc = xcorr(z,z);
% toc;
%
% % Cross correlation - my fft accelerated version
% tic;
% xf = myxcorr(z,z);
% toc;
%
% % Plotting the results
% plot(...
% 1:N-1, xc(1,:) , 'k.' ,...Filtered - spatial domain
% 1:N-1, xf(1,:) , 'r--'...Filtered - freq. domain
% );
% Author(s): A. Almqvist
% Copyright 2009- Andreas Almqvist
% $Revision: 1$ $Date: 2009/11$
% Homemade function
if nargin == 1
b = a;
end
c = myconv(a,rot90(conj(b),2));
|
|
Contact us at files@mathworks.com