-1
$\begingroup$

I have a wav signal I have imported into MATLAB, and I would like to find its envelope. I want to do this via the Hibert transform. But whenever I try to find the Hilbert transform of the signal I receive the following error message:

>Warning:HILBERT ignores imaginary part of input. 
>> In hilbert (line 38) 
Undefined function 'real' for input arguments of type
'matlab.graphics.chart.primitive.Line'.

>>Error in hilbert (line 39)
  xr = real(xr);

Here are screenshots of the corresponding code:

enter image description here

I have found the function real.mat and made sure it is in a filepath accessible to MATLAB using the pathtool command. I still encounter this problem.

What should I do?

-Joseph

$\endgroup$
  • $\begingroup$ Your input signal is probably not what it should be. Check what it is, it should be a vector of doubles. $\endgroup$ – Matt L. Jul 27 '16 at 20:16
  • 1
    $\begingroup$ You are calling with the wrong arguments. Looks like you are passing it a line object (which something like plot() would return) and not with the actual data. $\endgroup$ – Hilmar Jul 29 '16 at 12:32
  • $\begingroup$ Votes and best answer validation are required for this question $\endgroup$ – Laurent Duval Jul 28 at 12:07
0
$\begingroup$

You might be using a command like data = plot(x,y) and then trying to compute hilbert(data). This looks consistent with your title executing Hilbert transform on xx-yy plot. Instead, you should try plot(x,abs(hilbert(y))).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.