Detection of large amplitudes
7 views (last 30 days)
I have a signal with random noise and 4 times a large amplitude appears. How do I create (can someone direct me on what I'm doing incorrectly) to output an estimation of when the large amplitude appears on the x axis?
nt = 4000;
a = (rand(1,nt1)-0.5)*10;
b = (rand(1,nt)-0.5)*3;
c = rand(1,4);
b(it+[1:nt1]) = b(it+(1:nt1)) + a*c(tcount);
I originally tried to use a for loop to estimate the large amplitude position, but I recently switched to using the convolution function because it is supposed to be more efficient at solving this. The method I need to use is a moving average, hence the convolution function. Thoughts and suggestions? Thank you
sra = zeros(1, nt);
il = fix( ltw / dt);
is = fix(stw / dt);
nt = length(b);
kernel = ones(1,il)/il;
lta0 = conv(b,kernel,'same');
lta = lta0./(numel(il));
kernels = ones(1,is)/is;
sta0 = conv(b,kernels,'same');
sta = sta0./(numel(is));
itm = find(sra > threshold);
**EDITED 6-29-2017 10:33pm
large amplitudes at any frequencies. "large" referring to anything with an amplitude greater than the background noise that has been added to the signal.
Greg Dionne on 7 Jul 2017
Looks like you're interested in finding changes in variance.
If you have the Signal Processing Toolbox, try something like:
Jan on 29 Jun 2017
Edited: Jan on 30 Jun 2017
You can determine the envelope at first:
plot(envelope(b, 50, 'peak'), 'r');
plot(envelope(b, 100, 'rms'), 'g');
Now findpeaks allows the determination of the peaks.
The convolution reduces the effect of the larger amplitudes, because it is an averaging.
Let's wait if the professional signal processors have a more stringent suggestion.
Image Analyst on 30 Jun 2017
One option is to look at the median absolute deviation in a moving window. This essentially looks for outliers. https://en.wikipedia.org/wiki/Median_absolute_deviation Let me know if you can't create the code for it yourself.
Or like Jan mentioned, delve into the options of findpeaks(). Granted, those can be kind of confusing, but if you can understand them, you can probably get what you want from that function.