Fitting Envelope Peak Curves?

24 visualizzazioni (ultimi 30 giorni)
Chinwe Orie
Chinwe Orie il 26 Giu 2018
Commentato: Greg Dionne il 9 Lug 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 Commenti
Chinwe Orie
Chinwe Orie il 29 Giu 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 il 9 Lug 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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by