# Issue with DSP.Util.hilbert

**URL:** https://discourse.julialang.org/t/issue-with-dsp-util-hilbert/23842
**Category:** Modelling & Simulations
**Created:** [May 4, 2019, 5:32am UTC](https://discourse.julialang.org/t/issue-with-dsp-util-hilbert/23842 "2019-05-04T05:32:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![koenigjaeger](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@koenigjaeger](https://discourse.julialang.org/u/koenigjaeger)
#### Post date: [May 4, 2019, 5:32am UTC](https://discourse.julialang.org/t/issue-with-dsp-util-hilbert/23842/1 "2019-05-04T05:32:09Z")

</div>

I was looking to get the envelope of a signal and looking at the example at [Discrete-time analytic signal using Hilbert transform - MATLAB hilbert](https://www.mathworks.com/help/signal/ref/hilbert.html) and checking this in octave using the signal package from forge I am getting different results from Matlab/Octave to Julia.

Ex (Matlab):

```julia
xr = [1 2 3 4];
x = hilbert(xr)
x = 1×4 complex

   1.0000 + 1.0000i 2.0000 - 1.0000i 3.0000 - 1.0000i 4.0000 + 1.0000i

```

Ex (Julia):

```julia
julia> xr = [1 2 3 4];

julia> x = Util.hilbert(xr)
1×4 Array{Complex{Float64},2}:
 1.0+0.0im 2.0+0.0im 3.0+0.0im 4.0+0.0im

```

Any guessing to whats going on? I was using DSP.jl before the 1.0v release of Julia and it was fine.

---

<div class="post-metadata">

### Author: ![purplishrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/purplishrock/32/13451_2.png) [@purplishrock](https://discourse.julialang.org/u/purplishrock)
#### Post date: [May 4, 2019, 7:15am UTC](https://discourse.julialang.org/t/issue-with-dsp-util-hilbert/23842/2 "2019-05-04T07:15:16Z")

</div>

It looks like passing an integer array is the problem.  
I really think that’s buggy behavior, might be worth filing an issue.

```julia
julia> x = [1.0, 2.0, 3.0, 4.0]
4-element Array{Float64,1}:
 1.0
 2.0
 3.0
 4.0

julia> hilbert(x)
4-element Array{Complex{Float64},1}:
 1.0 + 1.0im
 2.0 - 1.0im
 3.0 - 1.0im
 4.0 + 1.0im

```
