Detection of large amplitudes

조회 수: 2 (최근 30일)
Raymond Ng
Raymond Ng 2017년 6월 29일
답변: Greg Dionne 2017년 7월 7일
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
John BG
John BG 2017년 6월 29일
could you please define 'large amplitudes'?
low frequencies only? any frequency large amplitude?
Jan
Jan 2017년 6월 29일
@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.

댓글을 달려면 로그인하십시오.

답변 (3개)

Greg Dionne
Greg Dionne 2017년 7월 7일
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 2017년 6월 29일
편집: Jan 2017년 6월 30일
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 2017년 6월 30일
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.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by