Fitting Envelope Peak Curves?

조회 수: 21 (최근 30일)
Chinwe Orie
Chinwe Orie 2018년 6월 26일
댓글: Greg Dionne 2018년 7월 9일
Hello,
I've been trying to take the peak envelope of a signal that I have, and I am able to get the upper and lower peak envelopes. However, the spacing with the peaks either causes the peaks to overlap (sometimes, the lower peak envelop curve will be higher than the upper) or for the curves not to be smooth. I have attached an image of what I'd like for the peaks to end up like and an image of what I actually got. :(
The first picture is what I got through this code. I want more of a hump shape a little bit like the picture on the very bottom. Basically if I got the same code, without the overlap my problem would be solved. The data is attached in a .zip folder.
f = xlsread('d2.csv');
%plotting the signal
t = f(:,1);
X1 = f(:,2);
%Some of the envelope code was not working properly because MATLAB read
%some lines of the excel file as infinite numbers. The envelope function
%does not take infinite numbers.
%Thus, the below code deletes the infinite numbers from the array. There
%are only 2 of them.
fin = isfinite(X1);
t = t(fin);
X1 = X1(fin);
X = X1;
% X = bandpass(X1, [50 185], 25000);
% Y = fft(X);
% y = hilbert(X);
figure;
[up, lo] = envelope(X,75800, 'peak');
plot(t,up,'r');
hold on
plot(t,X, 'b');
plot(t,lo,'k');
% plot(t,real(Y),'y');
% plot(t,imag(Y),'m');
hold off
f = xlsread('d2-2.csv');
%plotting the signal
t = f(:,1);
X1 = f(:,2);
%Some of the envelope code was not working properly because MATLAB read
%some lines of the excel file as infinite numbers. The envelope function
%does not take infinite numbers.
%Thus, the below code deletes the infinite numbers from the array. There
%are only 2 of them.
fin = isfinite(X1);
t = t(fin);
X1 = X1(fin);
X = X1;
% X = bandpass(X1, [50 185], 25000);
% Y = fft(X);
% y = hilbert(X);
figure;
[up, lo] = envelope(X,75800, 'peak');
plot(t,up,'r');
hold on
plot(t,X, 'b');
plot(t,lo,'k');
% plot(t,real(Y),'y');
% plot(t,imag(Y),'m');
hold off
  댓글 수: 3
Chinwe Orie
Chinwe Orie 2018년 6월 29일
For now I'd like to subtract the upper and lower envelope peaks in order to get the amplitude. After that I want to take the fft of the signal so I can create an amplitude-frequency plot.
Greg Dionne
Greg Dionne 2018년 7월 9일
You can adjust the sensitivity of the 'peak' variant.
[up, lo] = envelope(X,5000, 'peak');
Alternatively you could try the 'rms' variant after subtracting (and restoring) the mean.
A lot depends on what you want to do with the envelope when you're done with it.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by