File Exchange

## Envelope Detction for Signal Analysis

version 1.0 (649 KB) by

Computes the envelope of the signal by two methods: 1.LPF method 2.Hilbert Transform

Updated

y=envelope(Signal,Fs) computes the Envelope of the input Signal with a Sampling Frequency 'Fs' and gives the envelope signal by Hilbert transform method as the output y.
The function computes the envelope of the signal by two different methods.

First Method: By Using Low Pass Filter. The Signal is Squared, passed
through LPF and then taken square root.
Second Method: Using Hilbert Transform. Hilbert Transform is taken using the inbuilt function in Matlab

The Function Displays the FFT of the original signal and also the FFT of
the envelope signal by both the methods

The function basically is for computing Envelope Signal for Condition Monitoring of rotating equipments by vibration based bearing fault diagnosis.

Example:
signal=s4;
Fs=12000;
envelope(signal,Fs);

The File 's4.mat' is the vibration signal recorded from a OR faulty
bearing with a sampling frequency of 12000Hz. The Fault frequency is 161Hz and is brought out in envelope signal which was hidden in the original FFT.

Don't forget to rate or comment on the matlab central site
http://www.mathworks.in/matlabcentral/fileexchange/authors/258518

Author:Santhana Raj.A

Helo Santhana Raj, I found this envelope code useful in my research work and used it in analyzing my works.

Faisal ALSHAMMERRI

Alan

### Alan (view profile)

Thank you for a nice example.

Santhana Raj

### Santhana Raj (view profile)

@Haroldo
It seems that the length of the signal that you took is smaller than 4096. By default, I have taken a 4096 point FFT. So, unless you feed in a signal larger than 4096, the code will throw error.

Possible solutions are that you either pad zeros to your signal or reduce the No of points of the FFT(Variable N in the code)

Haroldo

### Haroldo (view profile)

"Index exceeds matrix dimensions
Error in envelope (line 46)"

:(

Chintan

### Chintan (view profile)

Hello Santhana,

Many thanks.

I have sent you an email on your gmail account.

Best Regards

Chintan

Santhana Raj

### Santhana Raj (view profile)

@Chintan

The carrier must be present in the received signal for envelope detection to work. The formula is (1+m(t))*c(t)

Any specific doubts, you can drop me a mail.

Chintan

### Chintan (view profile)

Hello Santhana,

Many thanks for your quick reply. Just one last question. I did some simulation for Amplitude modulations, where my message frequency is 10 Hz and carrier frequency is 100 Hz. But after running your script, the detected frequency is 20 Hz and not 10 Hz.

N = 50000;

fs = 1000;

t = (0:N-1)/fs;

msg = cos(2*pi*10*t);

carrier = cos(2*pi*100*t);

x = msg.*carrier;

output = envelope(x, fs);

Many thanks.

Best Regards

Chintan

Santhana Raj

### Santhana Raj (view profile)

@Chintan

Am not Fully Sure of the carrier frequency. But I have always assumed it to be the natural frequency of the system, either bearing or the motor itself. But whatever be the case, the carrier frequency is supposed to be very high and a generally a 0.1 cut off frequency would comfortably remove it here.

Hope this helps.

Chintan

### Chintan (view profile)

Hello Santhana,

Thanks for your reply. In bearing analysis, what is considered as carrier frequency? I have read few papers and all say different definitions.

Thanks.

Best Regards

Chintan

Santhana Raj

### Santhana Raj (view profile)

@Chintan

Yep. U guessed right. The shaft speed is about 29Hz.

Thanks for Rating.

Chintan

### Chintan (view profile)

Hi Santhana,

Very nice code and good example. I just have one question. The other spike at 29.3 Hz, does it correspond to shaft speed?

Many thanks.

Chintan

Ruiyan

### Ruiyan (view profile)

good, can be used normally.thanks very much.

Theodoros

ahmed albakri

### ahmed albakri (view profile)

Hi friend , thank you very much

gülsevin

n chow

Santhana Raj

### Santhana Raj (view profile)

@Jan Simon

True, This is just a demonstration of the two methods. Who would want to use different methods when one's ultimate aim is to do some envelope detection.

I thought it would be easier, as any one can compare the methods for their application and use the code from the program by coping those set of lines and reusing them in their main code.

Jan Simon

### Jan Simon (view profile)

"clc; close all;" is not a friendly idea. Why do you want to close my figures?

This function cannot be used to create the envelope directly. It is more a demonstration of the two different method with harddoced coefficients, creation of figures and overwriting the output y repeatedly. So before a user can calculate the envelopes matching to a specific problem, substantial re-programming is required.

##### MATLAB Release
MATLAB 7.13 (R2011b)