# Interpolations with Unitful Vectors

**URL:** <https://discourse.julialang.org/t/interpolations-with-unitful-vectors/80919>\
**Category:** General Usage\
**Tags:** interpolations, unitful\
**Created:** [May 11, 2022, 10:18pm UTC](https://discourse.julialang.org/t/interpolations-with-unitful-vectors/80919 "2022-05-11T22:18:39Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)\
**Post date:** [May 11, 2022, 11:50pm UTC](https://discourse.julialang.org/t/interpolations-with-unitful-vectors/80919/2 "2022-05-11T23:50:40Z")

</div>

I think this is an oversight in Interpolations. Unitful interpolation works fine for Gridded interpolation as shown in the [tests](https://github.com/JuliaMath/Interpolations.jl/blob/master/test/extrapolation/type-stability.jl#L73), the trick there is that both positions and values are arrays, not ranges. For your example here:

```julia
Xs = collect((0:0.1:5)u"m")
Ys = Xs .^ 2
itp = LinearInterpolation(Xs, Ys)

itp(5.0u"inch")

```

The problem is that currently scaled interpolation does not work, lets see if this [PR](https://github.com/JuliaMath/Interpolations.jl/pull/490) to fix it is accepted, then this will work:

```julia
Xs = (0:0.1:5)u"m"
Ys = Xs .^ 2
sitp = scale(interpolate(Ys, BSpline(Linear())), Xs)

sitp(5.0u"inch")
```

---

_[View the full topic](https://discourse.julialang.org/t/interpolations-with-unitful-vectors/80919)._
