Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complex numbers in Spline1D #76

Open
psteffensen opened this issue Feb 4, 2021 · 0 comments
Open

Complex numbers in Spline1D #76

psteffensen opened this issue Feb 4, 2021 · 0 comments

Comments

@psteffensen
Copy link

I get an "inexacterror" when using a complex array of floats for Spline1D:

ERROR: InexactError: Float64(-1690.6161529533777 - 1214.84327391387im)

my_array looks like this:

julia> my_array[:]
12340-element Array{Complex{Float64},1}:
 -1690.6161529533777 - 1214.84327391387im
  -895.4613828155627 - 2012.3699900000424im
  -981.8496071930282 - 2613.8440510838im
 -1712.4126659718233 - 2936.555315343548im
  -2492.559747350752 - 2996.238395928293im
                     ⋮
 -1837.6891112079963 + 528.5228512955363im
  -3679.040165510708 + 849.8114560880327im
  -4570.730515975646 + 789.0130974446927im
  -4250.116932137339 + 354.47021983501594im
  -3047.113151368609 - 366.1991927217247im

The code looks like this:

        T_in = 1/fs_in
        T_out = 1/fs_out

        t_tot = length(my_array[:])*T_in
        no_of_samples = round(t_tot/T_out)

        t_in = 0:T_in:(length(my_array[:])-1)*T_in
        t_out = 0:T_out:(no_of_samples-1)*T_out
        spline = Spline1D(t_in, my_array[:])   # <-------- The inexact error occurs here
        out = spline(t_out)

I works for a non-complex arrays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant