Need help for Envelope analysis problem
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Seb Lepense
il 15 Giu 2015
Commentato: Star Strider
il 16 Giu 2015
Hello everyone.
I need a little help concerning an issue on an envelope analysis code and I'll be grateful for anykind of assistance. I'm trying to do the envelope of the FFT of an acquiered faulty bearing signal but the results are wrong.
At first, I tested the code with a simple sinusoidal signal. The code is based on two different methods for envelope analysis (using a low pass filter on one hand and a Hilbert Transform on the other) such as :
close all;
clear all ;
clc;
f0= 50;
n1 = 1024;
Fs = 10240;
t = (0:n1-1)/Fs;
s = sin (2*pi*f0*t);
%s = dlmread('x.txt','\t'); %(for reading my signal)
%Envelope Analysis based on a low pass filter
[a,b]=butter(2,0.1);
sig_abs=abs(s);
y = filter(a,b,sig_abs);
N = length(s);
NFFT = 2^nextpow2(N);
f = Fs/2*linspace(0,1,NFFT/2+1);
Y1 = fft(y,NFFT);
Y2= Y1/(norm(Y1));
figure
plot(f,abs(Y2(1:NFFT/2+1)))
title('Low Pass Filter Envelope analysis')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
%envelope analysis based on Hilbert transform
analy=hilbert(s);
y2=abs(analy);
T=N/Fs;
sig_f=abs(fft(y2(1:N)',N));
sig_n=sig_f/(norm(sig_f));
freq_s=(0:N-1)/T;
figure
plot(freq_s,sig_n);
axis ([0 5000 0 1])
title('Hilbert transform Envelope analysis')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
Here, the results are somewhat convincing aside from the fact that the signal frequency was doubled by the EA. Can you explain to me why the frequency is 100 and not 50 Hz. Is the EA supposed to this (and why exactly ?) or is something wrong here ?
But beyond that, my biggest problem is when I use this code for my particular signal. Because here the results don't make any sense at all and there's obviously something wrong with it. I attached my signal for you to see that the results plot with both methods are inexploitable. I really need you help to slove this problem and obtain a proper Envelope analysis for my signal.
Thanks for your help
0 Commenti
Risposta accettata
Star Strider
il 15 Giu 2015
I’m not quite sure what you’re doing, or what you want to do with the low-pass filter. One problem is that your ‘s’ variable is a (10240x2) matrix, and you were doing the fft and other analyses on the first column, that is the time vector (that I named ‘ts’). The signal is ‘s(:,2)’ (that I named ‘sig’). I changed the code to reflect these.
I would start by redesigning the filter. (I don’t know what cutoff frequency you want, but for an overview to the design of digital filters, consider this.) I would also not use the absolute value of the signal. Use it as it exists, in part because the absolute value introduces spurious frequencies.
I made some changes to your code to reflect these, and added figure(3) that indicates the Hilbert transform produces a quite reasonable approximation of the envelope.
The code (with revisions):
f0= 50;
n1 = 1024;
Fs = 10240;
t = (0:n1-1)/Fs;
s = sin (2*pi*f0*t);
s = dlmread('Seb Lepense x.txt','\t'); %(for reading my signal)
ts = s(:,1); % Time
sig = s(:,2); % Signal
%Envelope Analysis based on a low pass filter
[a,b]=butter(2,0.1);
sig_abs = sig;
y = filter(a,b,sig_abs);
N = length(sig);
NFFT = 2^nextpow2(N);
f = Fs/2*linspace(0,1,NFFT/2+1);
Y1 = fft(y,NFFT);
Y2= Y1/(norm(Y1));
figure
semilogy(f,abs(Y2(1:NFFT/2+1)))
title('Low Pass Filter Envelope analysis')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
axis ([0 5000 0 1])
%envelope analysis based on Hilbert transform
analy=hilbert(sig);
y2=abs(analy);
T=N/Fs;
sig_f=abs(fft(y2(1:N)',N));
sig_n=sig_f/(norm(sig_f));
freq_s=(0:N-1)/T;
figure
semilogy(freq_s,sig_n);
axis ([0 5000 0 1])
title('Hilbert transform Envelope analysis')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
figure(3)
plot(ts, sig, '-r', ts, y, '-b', ts, y2, '-g', ts, -y2, '-g')
grid
axis([0 0.025 ylim])
xlabel('Time')
ylabel('Amplitude')
legend('Original Signal', 'Low-Pass Filtered Signal', 'Hilbert Transform Envelope', 'Location', 'NE')
2 Commenti
Star Strider
il 16 Giu 2015
As always, my pleasure!
The low-pass filter can possibly be used for envelope detection, but I’ve never seen it used for such. If you’re going to do that, I would experiment with rectifying (taking the absolute value of) the signal first, start with a very low cutoff frequency and increasing it until you get an acceptable result. (The fft of the signal does not offer any specific clues, but you could estimate the passband of the filter by dividing the fft of the Hilbert transform by the fft of the original or rectified signal.) The filter output would then be the upper half of the envelope, so you would have to plot the positive and negative of it, such as is necessary to plot the Hilbert transform envelope.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Multirate Signal Processing 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!