Detection of large amplitudes

2 vues (au cours des 30 derniers jours)
Raymond Ng
Raymond Ng le 29 Juin 2017
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;
nt1= 100;
a = (rand(1,nt1)-0.5)*10;
b = (rand(1,nt)-0.5)*3;
c = rand(1,4);
tcount=0;
for it=[10,400,1030,2400]
tcount=tcount+1;
b(it+[1:nt1]) = b(it+(1:nt1)) + a*c(tcount);
end
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
dt=1;
ltw=200;
stw=20;
threshold=[1.5];
sra = zeros(1, nt);
il = fix( ltw / dt);
is = fix(stw / dt);
nt = length(b);
for turn=1:numel(len)
tic
kernel = ones(1,il)/il;
lta0 = conv(b,kernel,'same');
lta = lta0./(numel(il));
toc
end
for turn=1:numel(len)
tic
kernels = ones(1,is)/is;
sta0 = conv(b,kernels,'same');
sta = sta0./(numel(is));
toc
end
sra=abs(sta0./lta0);
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.
  2 commentaires
John BG
John BG le 29 Juin 2017
could you please define 'large amplitudes'?
low frequencies only? any frequency large amplitude?
Jan
Jan le 29 Juin 2017
@Raymond Ng: If you use the "{} Code" button for formatting the code, it will be readable. You forgot to mention why you think that you have done something incorrect.

Connectez-vous pour commenter.

Réponses (3)

Greg Dionne
Greg Dionne le 7 Juil 2017
Looks like you're interested in finding changes in variance.
If you have the Signal Processing Toolbox, try something like:
findchangepts(b,'Statistic','rms','MinThreshold',12)

Jan
Jan le 29 Juin 2017
Modifié(e) : Jan le 30 Juin 2017
You can determine the envelope at first:
axes('NextPlot', 'add');
plot(b, 'b');
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
Image Analyst le 30 Juin 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.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by