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:
MATLAB Beginner Question

Subject: MATLAB Beginner Question

From: Jason Ouzts

Date: 21 Oct, 2008 18:46:01

Message: 1 of 7

Hi,

I am new to MATLAB and am trying to learn how to program. I have two sets of data. The first set consists of 16 2-D data points (x1,y1). The second set consists of approximately 4000 3-D data points (x2,y2,z2). The data points came from the same specimen. What I am trying to do with Matlab is write a program that will look at the two sets of data and find my corresponding z1 coordinate based off of the second set of data points. So I would like the program to go through the second data set and pick out points near each point in the first data set then possibly use bilinear interpolation to come up with my z1 coordinate. Any help? Or do I need to provide more detail? Thanks in advance!

Subject: MATLAB Beginner Question

From: NZTideMan

Date: 21 Oct, 2008 18:55:09

Message: 2 of 7

On Oct 22, 7:46=A0am, "Jason Ouzts" <ouz...@mailbox.sc.edu> wrote:
> Hi,
>
> I am new to MATLAB and am trying to learn how to program. I have two sets=
 of data. The first set consists of 16 2-D data points (x1,y1). The second =
set consists of approximately 4000 3-D data points (x2,y2,z2). The data poi=
nts came from the same specimen. What I am trying to do with Matlab is writ=
e a program that will look at the two sets of data and find my correspondin=
g z1 coordinate based off of the second set of data points. So I would like=
 the program to go through the second data set and pick out points near eac=
h point in the first data set then possibly use bilinear interpolation to c=
ome up with my z1 coordinate. Any help? Or do I need to provide more detail=
? Thanks in advance!

Is the second set of data in a grid?
In other words, are the x2 equispaced and are the y2 equispaced?
Or are the points x2,y2 randomly distributed throughout the domain?

Subject: MATLAB Beginner Question

From: Sean Larkin

Date: 21 Oct, 2008 19:00:22

Message: 3 of 7

"Jason Ouzts" <ouztsj@mailbox.sc.edu> wrote in message <gdl819$jqs$1@fred.mathworks.com>...
> Hi,
>
> I am new to MATLAB and am trying to learn how to program. I have two sets of data. The first set consists of 16 2-D data points (x1,y1). The second set consists of approximately 4000 3-D data points (x2,y2,z2). The data points came from the same specimen. What I am trying to do with Matlab is write a program that will look at the two sets of data and find my corresponding z1 coordinate based off of the second set of data points. So I would like the program to go through the second data set and pick out points near each point in the first data set then possibly use bilinear interpolation to come up with my z1 coordinate. Any help? Or do I need to provide more detail? Thanks in advance!


I think something as simple as 'interp2' is the function you're looking for.

Subject: MATLAB Beginner Question

From: Jay

Date: 21 Oct, 2008 19:07:02

Message: 4 of 7

NZTideMan <mulgor@gmail.com> wrote in message <e4a5fa29-b0bc-4dfc-9650-b03fe28955bf@o4g2000pra.googlegroups.com>...
> On Oct 22, 7:46=A0am, "Jason Ouzts" <ouz...@mailbox.sc.edu> wrote:
> > Hi,
> >
> > I am new to MATLAB and am trying to learn how to program. I have two sets=
> of data. The first set consists of 16 2-D data points (x1,y1). The second =
> set consists of approximately 4000 3-D data points (x2,y2,z2). The data poi=
> nts came from the same specimen. What I am trying to do with Matlab is writ=
> e a program that will look at the two sets of data and find my correspondin=
> g z1 coordinate based off of the second set of data points. So I would like=
> the program to go through the second data set and pick out points near eac=
> h point in the first data set then possibly use bilinear interpolation to c=
> ome up with my z1 coordinate. Any help? Or do I need to provide more detail=
> ? Thanks in advance!
>
> Is the second set of data in a grid?
> In other words, are the x2 equispaced and are the y2 equispaced?
> Or are the points x2,y2 randomly distributed throughout the domain?


Unfortunately, x2,y2 are randomly distributed throughout the domain. Suggestions?

Subject: MATLAB Beginner Question

From: Bruno Luong

Date: 21 Oct, 2008 19:47:01

Message: 5 of 7

take a look at function griddata.

Bruno

Subject: MATLAB Beginner Question

From: Sean Larkin

Date: 21 Oct, 2008 19:49:01

Message: 6 of 7

"Jay " <ouztsj@mailbox.sc.edu> wrote in message <gdl98m$aeh$1@fred.mathworks.com>...
> NZTideMan <mulgor@gmail.com> wrote in message <e4a5fa29-b0bc-4dfc-9650-b03fe28955bf@o4g2000pra.googlegroups.com>...
> > On Oct 22, 7:46=A0am, "Jason Ouzts" <ouz...@mailbox.sc.edu> wrote:
> > > Hi,
> > >
> > > I am new to MATLAB and am trying to learn how to program. I have two sets=
> > of data. The first set consists of 16 2-D data points (x1,y1). The second =
> > set consists of approximately 4000 3-D data points (x2,y2,z2). The data poi=
> > nts came from the same specimen. What I am trying to do with Matlab is writ=
> > e a program that will look at the two sets of data and find my correspondin=
> > g z1 coordinate based off of the second set of data points. So I would like=
> > the program to go through the second data set and pick out points near eac=
> > h point in the first data set then possibly use bilinear interpolation to c=
> > ome up with my z1 coordinate. Any help? Or do I need to provide more detail=
> > ? Thanks in advance!
> >
> > Is the second set of data in a grid?
> > In other words, are the x2 equispaced and are the y2 equispaced?
> > Or are the points x2,y2 randomly distributed throughout the domain?
>
>
> Unfortunately, x2,y2 are randomly distributed throughout the domain. Suggestions?

While I'm unsure whether or not there is a Matlab function that can do this, I would just use the nearest neighbor values of the x,y pairs that you are trying to find a value for. If you're familiar with this it's like interpolating image intensities from the four nearest neighbor intensities if you have a subpixel coordinates. In your case it would not be as simple, but it can be done.

Subject: MATLAB Beginner Question

From: NZTideMan

Date: 22 Oct, 2008 03:41:40

Message: 7 of 7

On Oct 22, 8:07=A0am, "Jay " <ouz...@mailbox.sc.edu> wrote:
> NZTideMan <mul...@gmail.com> wrote in message <e4a5fa29-b0bc-4dfc-9650-b0=
3fe2895...@o4g2000pra.googlegroups.com>...
> > On Oct 22, 7:46=3DA0am, "Jason Ouzts" <ouz...@mailbox.sc.edu> wrote:
> > > Hi,
>
> > > I am new to MATLAB and am trying to learn how to program. I have two =
sets=3D
> > =A0of data. The first set consists of 16 2-D data points (x1,y1). The s=
econd =3D
> > set consists of approximately 4000 3-D data points (x2,y2,z2). The data=
 poi=3D
> > nts came from the same specimen. What I am trying to do with Matlab is =
writ=3D
> > e a program that will look at the two sets of data and find my correspo=
ndin=3D
> > g z1 coordinate based off of the second set of data points. So I would =
like=3D
> > =A0the program to go through the second data set and pick out points ne=
ar eac=3D
> > h point in the first data set then possibly use bilinear interpolation =
to c=3D
> > ome up with my z1 coordinate. Any help? Or do I need to provide more de=
tail=3D
> > ? Thanks in advance!
>
> > Is the second set of data in a grid?
> > In other words, are the x2 equispaced and are the y2 equispaced?
> > Or are the points x2,y2 randomly distributed throughout the domain?
>
> Unfortunately, x2,y2 are randomly distributed throughout the domain. Sugg=
estions?- Hide quoted text -
>
> - Show quoted text -

Try:
z1=3Dgriddata(x2,y2,z2,x1,y1);

Tags for this Thread

No tags are associated with 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