1

I am trying to get an envelope for a spectrum I measured.

I have used the hilbert function in MATLAB which works for a dummy function I wrote,

but it does not give the correct result for my spectrum. (I got back the exact same curve).

I am thinking the oscillation of my spectrum is too fast but not too sure on this.

Hope someone can tell me what is wrong here.

A=xlsread('test.xls');
y=A(:,2);
h1=imag(hilbert(y)); 
E=sqrt(y.^2+h1.^2);
Rashid
  • 4,326
  • 2
  • 29
  • 54
kmb
  • 11
  • 2
  • Did you want to write exp((-1/(x-5))^(2/5))? – ha9u63a7 Oct 28 '14 at 08:26
  • The '1' was originally some other number which determines the FWHM but anyway this is the dummy function that I wrote which is just a Gaussian envelope over a sine curve. – kmb Oct 28 '14 at 08:40
  • Would it be possible for you to simply post the entire code base including 1) The data you are analysing 2) The place where you are having problems. Also, Do you know what sort of hilbert transform result you are expecting? e.g. sin(t) will be -cos(t) [Hilibert].... – ha9u63a7 Oct 28 '14 at 08:43
  • This is basically the whole code. I am reading the data from an excel file so the only code that is missing here is the xlsread. I read data from a measurement so I don't think there is any function like cosine to expect. – kmb Oct 28 '14 at 08:59
  • If I try you code (with the original example function), I get [this](http://i.imgur.com/n47rUMD.png). What is wrong with that envelope ? – Hoki Oct 28 '14 at 09:12
  • There is nothing wrong with that envelope. Like I said, the dummy function works fine. Its just that when I use the data I measured I get back the same function instead of it's envelope. – kmb Oct 28 '14 at 09:38
  • Is your `'test.xls'` data periodic? Can you post this data some place to download? – horchler Nov 04 '14 at 23:34

0 Answers0