View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Envelope Detction for Signal Analysis

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

4.0 | 8 ratings Rate this file 79 Downloads (last 30 days) File Size: 649 KB File ID: #37545 Version: 1.0
image thumbnail

Envelope Detction for Signal Analysis


Santhana Raj (view profile)


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

| Watch this File

File Information

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.


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

Author:Santhana Raj.A

Required Products Signal Processing Toolbox
MATLAB release MATLAB 7.13 (R2011b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (19)
08 Sep 2016 Kenny Adenuga

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

Comment only
29 Aug 2016 Faisal ALSHAMMERRI  
16 Sep 2015 Alan

Alan (view profile)

Thank you for a nice example.

10 Oct 2014 Santhana Raj

Santhana Raj (view profile)

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)

Comment only
09 Oct 2014 Haroldo

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


30 Jul 2014 Chintan

Hello Santhana,

Many thanks.

I have sent you an email on your gmail account.

Best Regards


Comment only
30 Jul 2014 Santhana Raj

Santhana Raj (view profile)


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.

Comment only
30 Jul 2014 Chintan

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


Comment only
30 Jul 2014 Santhana Raj

Santhana Raj (view profile)


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.

Comment only
29 Jul 2014 Chintan

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.


Best Regards


Comment only
12 Jun 2014 Santhana Raj

Santhana Raj (view profile)


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

Thanks for Rating.

Comment only
06 Jun 2014 Chintan

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.


08 Mar 2014 Ruiyan

Ruiyan (view profile)

good, can be used normally.thanks very much.

08 Jun 2013 Theodoros  
10 Dec 2012 ahmed albakri

Hi friend , thank you very much

Comment only
05 Aug 2012 gülsevin  
19 Jul 2012 n chow

n chow (view profile)

19 Jul 2012 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.

Comment only
18 Jul 2012 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.

Comment only

Contact us