1

I'm attempting to use scale space implementation to fit n Gaussian curves to peaks in a noisy time series digital signal (measuring voltage). To test it I created the following sample sum of three gaussians with noise (0.2*rand, sorry no picture, i'm new here)

amp = [2; 0.9; 1.3];
mu = [19; 23; 28];
sigma = [4.8; 1.3; 2.5];
x = linspace(1,50,1000);
for n=1:3, y(n,:) = A(n)*exp(-(x-B(n)).^2./(2*C(n)^2)); end
noisysignal = y(1,:) + y(2,:) + y(3,:) + 0.2*rand(1,numel(x))

I found this article http://www.engineering.wright.edu/~agoshtas/GMIP94.pdf posted by user355856 answer to thread "Peak decomposition"! I believe my code generates the correct result for plotting the zero crossings as a function of the gaussian filter resolution sigma, but I have two issues. The first is that it seems yet another fitting routine would be needed to identify the approximate location of the arch intercepts for approximating the initial peak sigma and mu values. The second is that the edges of the scale space plot have substantial arches that definitely do not correspond to any peak. I'm not sure how to screen these out effectively. Last thing is that is used a spacing of 50 when calculating the second derivative central finite difference since too much more destroyed feature, and to much less results in a forest of zero crossings. Would there be a better way to filter that to control random zero crossings in the gaussian peak tails?

function [crossing] = scalespace(x, y, sigmalimit)
figure; hold on; ylim([0 sigmalimit]);
for sigma = 1:sigmalimit %
yconv = convkernel(sigma, y); %convolve with kernel
xconv = linspace(x(1), x(end), length(yconv));
yconvpp = d2centralfinite(xconv, yconv, 50); % 50 was empirically chosen
num = 0;
for i = 1 : length(yconvpp)-1
    if sign(yconvpp(i)) ~= sign(yconvpp(i+1))
        crossing(sigma, num+1) = xconv(i);
        num = num+1;
    end
end
plot(crossing(sigma, crossing(sigma, :) ~= 0),...
     sigma*ones(1, numel(crossing(sigma, crossing(sigma, :) ~= 0))), '.');
end

function [yconv] = convkernel(sigma, y)
t = sigma^2;
C = 3; % for kernel truncation
M = C*round(sqrt(t))+1;
window = (-M) : (+M);
G = zeros(1, length(window));
G(:) = (1/(2*pi()*t))*exp(-(window.^2)./(2*t));
yconv = conv(G, y);

This is my first post and I apologize in advance for any issues in style. I'm fairly new to programming, so any advice regarding the programming style or information provided in this question would be much appreciated. I also read through Amro's answer about matlab's GMM function! if anyone feels that would be a more efficient approach to modeling multiple gaussians in a digital signal.

Thank you!

Community
  • 1
  • 1
huojitwigg
  • 11
  • 2
  • You can post picture on some external website and then we can upload it here for you. – Autonomous Jan 21 '15 at 21:23
  • Ah, thanks! Here is the original [Sum of Gaussians](http://tinypic.com/view.php?pic=waopon&s=8#.VMEhIkfF8Ro) and the [Scale Space](http://tinypic.com/view.php?pic=2rmxth3&s=8#.VMEhmkfF8Ro) created by my code – huojitwigg Jan 22 '15 at 16:13

0 Answers0