Fitting Envelope Peak Curves?

23 次查看(过去 30 天)
Chinwe Orie
Chinwe Orie 2018-6-26
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