# Problem executing Hilbert transform on $x$-$y$ plot in MATLAB

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:

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

• Your input signal is probably not what it should be. Check what it is, it should be a vector of doubles. – Matt L. Jul 27 '16 at 20:16
• 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. – Hilmar Jul 29 '16 at 12:32
• Votes and best answer validation are required for this question – Laurent Duval Jul 28 at 12:07

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))).