Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
3D velocity interpolation

Subject: 3D velocity interpolation

From: Dzevad Krdzalic

Date: 1 Apr, 2013 16:34:24

Message: 1 of 10

Hello

I have set of 3D Cartesian coordinates and their velocities:
X Y Z vx vy vz
100 100 100 3.2 1.3 2.3
125 135 146 1.8 1.2 -1.3
135 142 108 2.1 -1.8 1.2
95 85 88 2.1 2.1 1.1

and I have set of 3D coordinates without velocity
X Y Z
140 120 120
125 111 118
118 111 111

and I want to compute their velocities. Does anyone one how to do this?

Subject: 3D velocity interpolation

From: Josh Meyer

Date: 1 Apr, 2013 17:49:38

Message: 2 of 10

From the doc for interp3:

 Vq = interp3(X,Y,Z,V,Xq,Yq,Zq) interpolates to find Vq, the values of the
underlying 3-D function V at the query points in arrays Xq,Yq and Zq.
Xq,Yq,Zq must be arrays of the same size or vectors... Arrays X,Y and Z
specify the points at which the data V is given.

Your first matrix contains X, Y, Z, and the associated velocity information
for each point, V.
Your second matrix contains the query points.

For more info,
http://www.mathworks.com/help/matlab/ref/interp3.html

Josh Meyer
josh.meyer@mathworks.com

"Dzevad Krdzalic" <dzevadkrdzalic@gmail.com> wrote in message
news:kjccug$asi$1@newscl01ah.mathworks.com...
> Hello
>
> I have set of 3D Cartesian coordinates and their velocities:
> X Y Z vx vy vz
> 100 100 100 3.2 1.3 2.3
> 125 135 146 1.8 1.2 -1.3
> 135 142 108 2.1 -1.8 1.2
> 95 85 88 2.1 2.1 1.1
>
> and I have set of 3D coordinates without velocity
> X Y Z
> 140 120 120
> 125 111 118
> 118 111 111
>
> and I want to compute their velocities. Does anyone one how to do this?

Subject: 3D velocity interpolation

From: Dzevad Krdzalic

Date: 1 Apr, 2013 20:06:10

Message: 3 of 10

"Josh Meyer" <jmeyer@mathworks.com> wrote in message <kjchbk$q9k$1@newscl01ah.mathworks.com>...
> From the doc for interp3:
>
> Vq = interp3(X,Y,Z,V,Xq,Yq,Zq) interpolates to find Vq, the values of the
> underlying 3-D function V at the query points in arrays Xq,Yq and Zq.
> Xq,Yq,Zq must be arrays of the same size or vectors... Arrays X,Y and Z
> specify the points at which the data V is given.
>
> Your first matrix contains X, Y, Z, and the associated velocity information
> for each point, V.
> Your second matrix contains the query points.
>
> For more info,
> http://www.mathworks.com/help/matlab/ref/interp3.html
>
> Josh Meyer
> josh.meyer@mathworks.com
>
> "Dzevad Krdzalic" <dzevadkrdzalic@gmail.com> wrote in message
> news:kjccug$asi$1@newscl01ah.mathworks.com...
> > Hello
> >
> > I have set of 3D Cartesian coordinates and their velocities:
> > X Y Z vx vy vz
> > 100 100 100 3.2 1.3 2.3
> > 125 135 146 1.8 1.2 -1.3
> > 135 142 108 2.1 -1.8 1.2
> > 95 85 88 2.1 2.1 1.1
> >
> > and I have set of 3D coordinates without velocity
> > X Y Z
> > 140 120 120
> > 125 111 118
> > 118 111 111
> >
> > and I want to compute their velocities. Does anyone one how to do this?

Unfortunately I can't get results. I have read about this in manual, but there is no example like this.

Subject: 3D velocity interpolation

From: giometar

Date: 2 Apr, 2013 13:00:13

Message: 4 of 10

Does anyone can do this example? I really need this.
Thanks a lot...

Subject: 3D velocity interpolation

From: Steven_Lord

Date: 2 Apr, 2013 14:44:11

Message: 5 of 10



"Dzevad Krdzalic" <dzevadkrdzalic@gmail.com> wrote in message
news:kjcpbi$pj5$1@newscl01ah.mathworks.com...
> "Josh Meyer" <jmeyer@mathworks.com> wrote in message
> <kjchbk$q9k$1@newscl01ah.mathworks.com>...

*snip*

>> > I have set of 3D Cartesian coordinates and their velocities:
>> > X Y Z vx vy vz
>> > 100 100 100 3.2 1.3 2.3
>> > 125 135 146 1.8 1.2 -1.3
>> > 135 142 108 2.1 -1.8 1.2
>> > 95 85 88 2.1 2.1 1.1
>> >
>> > and I have set of 3D coordinates without velocity
>> > X Y Z
>> > 140 120 120
>> > 125 111 118
>> > 118 111 111
>> >
>> > and I want to compute their velocities. Does anyone one how to do this?
>
> Unfortunately I can't get results. I have read about this in manual, but
> there is no example like this.

Show the group what you tried with the small data set above and explain what
happened.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: 3D velocity interpolation

From: giometar

Date: 2 Apr, 2013 17:22:05

Message: 6 of 10

"Steven_Lord" <slord@mathworks.com> wrote in message <kjeqrr$190$1@newscl01ah.mathworks.com>...
>
>
> "Dzevad Krdzalic" <dzevadkrdzalic@gmail.com> wrote in message
> news:kjcpbi$pj5$1@newscl01ah.mathworks.com...
> > "Josh Meyer" <jmeyer@mathworks.com> wrote in message
> > <kjchbk$q9k$1@newscl01ah.mathworks.com>...
>
> *snip*
>
> >> > I have set of 3D Cartesian coordinates and their velocities:
> >> > X Y Z vx vy vz
> >> > 100 100 100 3.2 1.3 2.3
> >> > 125 135 146 1.8 1.2 -1.3
> >> > 135 142 108 2.1 -1.8 1.2
> >> > 95 85 88 2.1 2.1 1.1
> >> >
> >> > and I have set of 3D coordinates without velocity
> >> > X Y Z
> >> > 140 120 120
> >> > 125 111 118
> >> > 118 111 111
> >> >
> >> > and I want to compute their velocities. Does anyone one how to do this?
> >
> > Unfortunately I can't get results. I have read about this in manual, but
> > there is no example like this.
>
> Show the group what you tried with the small data set above and explain what
> happened.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

I tried to compute velocities for points with coordinates
X Y Z
140 120 120
125 111 118
118 111 111

I try to use VI = INTERP3(X,Y,Z,V,XI,YI,ZI) function, but I am not sure how it works, and what I should use as X, Y, Z, V, XI, YI, ZI.

Subject: 3D velocity interpolation

From: Steven_Lord

Date: 3 Apr, 2013 13:47:57

Message: 7 of 10



"giometar " <dzevadkrdzalic@gmail.com> wrote in message
news:kjf43t$470$1@newscl01ah.mathworks.com...
> "Steven_Lord" <slord@mathworks.com> wrote in message
> <kjeqrr$190$1@newscl01ah.mathworks.com>...

*snip*

> I tried to compute velocities for points with coordinates
> X Y Z
> 140 120 120
> 125 111 118
> 118 111 111
>
> I try to use VI = INTERP3(X,Y,Z,V,XI,YI,ZI) function, but I am not sure
> how it works, and what I should use as X, Y, Z, V, XI, YI, ZI.

V is the data you're trying to interpolate. In this case, since you have
three sets of data to interpolate, you'll need to call INTERP3 three times.
X, Y, and Z are the coordinates at which you collected the V data.
XI, YI, and ZI are the coordinates for which you want interpolated results.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: 3D velocity interpolation

From: giometar

Date: 3 Apr, 2013 19:00:06

Message: 8 of 10

"Steven_Lord" <slord@mathworks.com> wrote in message <kjhbud$sf6$1@newscl01ah.mathworks.com>...
>
>
> "giometar " <dzevadkrdzalic@gmail.com> wrote in message
> news:kjf43t$470$1@newscl01ah.mathworks.com...
> > "Steven_Lord" <slord@mathworks.com> wrote in message
> > <kjeqrr$190$1@newscl01ah.mathworks.com>...
>
> *snip*
>
> > I tried to compute velocities for points with coordinates
> > X Y Z
> > 140 120 120
> > 125 111 118
> > 118 111 111
> >
> > I try to use VI = INTERP3(X,Y,Z,V,XI,YI,ZI) function, but I am not sure
> > how it works, and what I should use as X, Y, Z, V, XI, YI, ZI.
>
> V is the data you're trying to interpolate. In this case, since you have
> three sets of data to interpolate, you'll need to call INTERP3 three times.
> X, Y, and Z are the coordinates at which you collected the V data.
> XI, YI, and ZI are the coordinates for which you want interpolated results.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

I try but i get massage:
??? Error using ==> interp3 at 129
V must be a 3-D array.
 
X=[100
125
135
95];
Y=[100
135
142
85];
Z=[100
146
108
88];
V=[3.2
1.8
2.1
2.1];
XI=[140
125
118];
YI=[120
111
111];
ZI=[120
118
111];

>> VI=interp3(X,Y,Z,V1,XI,YI,ZI)
??? Error using ==> interp3 at 129
V must be a 3-D array.

Subject: 3D velocity interpolation

From: Steven_Lord

Date: 4 Apr, 2013 13:44:11

Message: 9 of 10



"giometar " <dzevadkrdzalic@gmail.com> wrote in message
news:kjhu7m$1ks$1@newscl01ah.mathworks.com...
> "Steven_Lord" <slord@mathworks.com> wrote in message
> <kjhbud$sf6$1@newscl01ah.mathworks.com>...

*snip*

> I try but i get massage:
> ??? Error using ==> interp3 at 129
> V must be a 3-D array.

That is correct.

> X=[100 125
> 135
> 95];

Four data points isn't enough for you to be able to do very much 3-D
interpolation. For INTERP3 you need to provide the values of your functions
on a 3-D grid of points (at a bare minimum, I'd say you'll want data for at
least the eight corners of a cube.) For the cube case you'd need to provide
X, Y, Z, and V as 2-by-2-by-2 arrays:

% Generate the arrays with the corners of the cube
[X, Y, Z] = meshgrid([1 2])

% V is a function of X, Y, and Z. Normally you wouldn't know this; I'm using
a known function to generate sample data.
V = X+Y-Z

% This should (and does) give us 1.5 as the value of V interpolated at the
center of the cube
% 1.5 + 1.5 - 1.5 = 1.5
valueAtCenter = interp3(X, Y, Z, V, 1.5, 1.5, 1.5)

For interpolating data that's not on a grid but is scattered, see:

http://www.mathworks.com/help/matlab/scattered-data-interpolation.html

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: 3D velocity interpolation

From: giometar

Date: 4 Apr, 2013 17:39:18

Message: 10 of 10

"Steven_Lord" <slord@mathworks.com> wrote in message <kjk03b$6m8$1@newscl01ah.mathworks.com>...
>
>
> "giometar " <dzevadkrdzalic@gmail.com> wrote in message
> news:kjhu7m$1ks$1@newscl01ah.mathworks.com...
> > "Steven_Lord" <slord@mathworks.com> wrote in message
> > <kjhbud$sf6$1@newscl01ah.mathworks.com>...
>
> *snip*
>
> > I try but i get massage:
> > ??? Error using ==> interp3 at 129
> > V must be a 3-D array.
>
> That is correct.
>
> > X=[100 125
> > 135
> > 95];
>
> Four data points isn't enough for you to be able to do very much 3-D
> interpolation. For INTERP3 you need to provide the values of your functions
> on a 3-D grid of points (at a bare minimum, I'd say you'll want data for at
> least the eight corners of a cube.) For the cube case you'd need to provide
> X, Y, Z, and V as 2-by-2-by-2 arrays:
>
> % Generate the arrays with the corners of the cube
> [X, Y, Z] = meshgrid([1 2])
>
> % V is a function of X, Y, and Z. Normally you wouldn't know this; I'm using
> a known function to generate sample data.
> V = X+Y-Z
>
> % This should (and does) give us 1.5 as the value of V interpolated at the
> center of the cube
> % 1.5 + 1.5 - 1.5 = 1.5
> valueAtCenter = interp3(X, Y, Z, V, 1.5, 1.5, 1.5)
>
> For interpolating data that's not on a grid but is scattered, see:
>
> http://www.mathworks.com/help/matlab/scattered-data-interpolation.html
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

I have set of 8 points with coordinates in WGS84 coordinate system. I also have their velocities in all 3 directions:
       X Y Z VX VY VZ
4419850.0746 1449976.7916 4342349.2054 -0.0120 0.0150 0.0150
4383280.2502 1445945.1038 4381848.2265 -0.0219 0.0158 0.0101
4332639.4110 1341448.7003 4462208.7992 -0.0226 0.0159 0.0094
4337812.1439 1232986.9458 4487940.1024 -0.0204 0.0160 0.0104
4449600.2054 1475764.2631 4303547.9651 -0.0199 0.0161 0.0121
4406004.8405 1334752.2050 4392272.4112 -0.0150 0.0163 0.0084
4413575.7221 1480072.8296 4338788.8062 -0.0217 0.0175 0.0112
4366345.9583 1453582.1956 4393993.5639 -0.0195 0.0141 0.0113

I have 5 points without velocities, and I need to calculate their velocities:
         X Y Z
4439976.9708 1404043.0310 4344473.0854
4376426.5423 1431945.1445 4400147.7451
4380185.5352 1363141.7833 4418712.4010
4338411.0897 1486099.3944 4420332.0717
4294560.0253 1489254.1866 4459744.3050

I think that I should use scatteredInterpolant to perform interpolation.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us