Fitting Envelope Peak Curves?

21 Ansichten (letzte 30 Tage)
Chinwe Orie
Chinwe Orie am 26 Jun. 2018
Kommentiert: Greg Dionne am 9 Jul. 2018
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 Kommentare
Chinwe Orie
Chinwe Orie am 29 Jun. 2018
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 am 9 Jul. 2018
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by