Troubling using Envelope Function - Envelope Curves Overlap!
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I am trying to use the envelope function to connect peaks of my signal. In order for the waveform to be a smooth "hump" looking curve, I tried using a bandpass filter in order to filter out signals that would interference with the smoothness of the curve. After using the bandpass filter, I found that along the flat lines of the signals (where the signal had been filtered out), the upper and lower envelope peak curve overlapped! I tried zooming on the graph to see why this occurred but no luck. It seemed very bizarre to me. Is this just a glitch or is there something wrong with my code?
CODE:
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 = bandpass(X1, [70 120], 25000);
X = bandpass(X, [102 119], 25000);
% Y = fft(X);
% y = hilbert(X);
figure;
[up, lo] = envelope(X, 25000, 'peak');
plot(t,up,'r');
hold on
plot(t,X, 'b');
plot(t,lo,'k');
hold off
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!