Closed jmarcellopereira closed 8 years ago
You can do this with Grid, but Interpolations.jl is better in basically every way. See this section of the docs.
Hi Tim. I used this code:
using Interpolations
x = [0 0.50 1 1.50 2 2.50 3 3.50 4 4.50 5]; y = [1. 3. 4. 6. 9. 7. 8. 4. 3. 8. 10.]; xx = vec(x); yy = vec(y);
yint = interpolate((xx,), yy, Gridded(Linear()));
using Winston
Winston.plot(x,y,"or", 0:0.1:10, map(x->yint[x],0:0.1:10) )
But, Grid it is more intuitive.
In this case, x could be the range 0:.5:5, so you could also use
using Interpolations
itp = interpolate(y, Linear(), OnGrid())
sitp =scale(itp, 0:.5:5)
fine_y = map(x->sitp[x], 0:.1:5)
Hi, tlycken, thanks for tip ;)
Anytime :) I'll close this issue - feel free to file another one, or (better yet) send an email to the julia-users Google Group, if you need more help!
I have this points: x = [0 0.50 1 1.50 2 2.50 3 3.50 4 4.50 5]; y = [1. 3. 4. 6. 9. 7. 8. 4. 3. 8. 10.];
How to yi function using interpolate? only works if x is a range.