Interpolation
Interpolation
(OP)
Hello everyone,
I need to interpolate a trajectory.
The trajectory is an array with the X and Y coordinates. The problem is that, since it is not a function, there are more that one Y value for each X and vicecersa.
For example:
Trajectory:
[1 4
2 5
3 6
4 8
5 10
6 11
7 12
9 11
10 9
9 8
8 7
7 6
7 5
8 5
9 4
11 4
12 4]
I tried to use the function interp1 but it gives me an error because my trajectory is not a function.
Since the position is stored with a frequency of 14 Hz, I have lost some information of the path. This is why I need an interpolation.
Moreover I have also multiple X for the same Y. It means that transpose the X with the Y doesn't help.
How can I do it?
There is a function that interpolates trajectory and not only function?
Is there any function in Matlab that allows me to interpolate vectors?
Thanks in advance to everyone
Andrea
I need to interpolate a trajectory.
The trajectory is an array with the X and Y coordinates. The problem is that, since it is not a function, there are more that one Y value for each X and vicecersa.
For example:
Trajectory:
[1 4
2 5
3 6
4 8
5 10
6 11
7 12
9 11
10 9
9 8
8 7
7 6
7 5
8 5
9 4
11 4
12 4]
I tried to use the function interp1 but it gives me an error because my trajectory is not a function.
Since the position is stored with a frequency of 14 Hz, I have lost some information of the path. This is why I need an interpolation.
Moreover I have also multiple X for the same Y. It means that transpose the X with the Y doesn't help.
How can I do it?
There is a function that interpolates trajectory and not only function?
Is there any function in Matlab that allows me to interpolate vectors?
Thanks in advance to everyone
Andrea
RE: Interpolation
Are these points sufficiently accurate to use for a spline fit?
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: Interpolation
As you say, interp1 and friends won't do non-functions, so you need to generate an equivalent function by parameterising. By using a simple parameterisation on both the X and Y points, you get two functions that can be independently interpolated. De-parameterisation will then give you the interpolation of the original non-function.
CODE --> matlab
Now as IRstuff goes on to say, maybe a linear interpolation is not ideal. Good news is that other interpolation functions slot right in:
CODE --> matlab
CODE --> matlab