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:
extracting X&Y values

Subject: extracting X&Y values

From: Model Ramachandran

Date: 9 Jan, 2009 11:34:02

Message: 1 of 4

Hi Friends,

I have plotted the graph using x,y values :

For X values I am using " handles.x_vg=[-0.5:.05:1.5]; " So x varies from -0.5 to 1.5
                       For Y I have array of datas.

I would like to extract value of Y when X=0;

Could any one help me ...

Thanks with Regards
Selvaa

Subject: extracting X&Y values

From: ImageAnalyst

Date: 9 Jan, 2009 11:38:37

Message: 2 of 4

Selvaa:
You have to interpolate since you don't have a Y value for that exact
x value. You can do bilinear, splines, etc. Lots of methods to
choose from. Which method do you want? It's best to choose once you
know the trend in your y data.
Regards,
ImageAnalyst

Subject: extracting X&Y values

From: Model Ramachandran

Date: 9 Jan, 2009 12:27:01

Message: 3 of 4

Hi ImageAnalyst,

Thanks for your reply,

I have 40 (x,y) values totally...the Y value will be as a column in "temp" value.X value will be column in X_vg variable. I dnt know how to interpolate.temp"

I havent any methods before so if you give some example it will be more useful

THX









ImageAnalyst <imageanalyst@mailinator.com> wrote in message <20e1c8f8-8a33-423f-9556-5fa3de972889@r28g2000vbp.googlegroups.com>...
> Selvaa:
> You have to interpolate since you don't have a Y value for that exact
> x value. You can do bilinear, splines, etc. Lots of methods to
> choose from. Which method do you want? It's best to choose once you
> know the trend in your y data.
> Regards,
> ImageAnalyst

Subject: extracting X&Y values

From: ImageAnalyst

Date: 9 Jan, 2009 13:35:00

Message: 4 of 4

Model Ramachandran:
Do you want to do a regression to model your data? Let's say that
your data are physical measurements and follow, roughly, a quadratic
curve, but each data point could have some noise on it so it's not the
exact y value that it should be. Then you can do a regression using
polyfit to get a least squares quadratic curve that goes through the
data points (but does not necessarily hit each one exactly). Then you
simply use polyval to get the ESTIMATED y value for whatever x value
you want to plug in. Alternatively you can use cubic splines to
piecewise fit a cubic to each subset of 3 or 4 points. Or you could
just assume your data points are exact and you want to just fit a
straight line piecewise through the data (a new line between each pair
of points). This is the easiest and most straightforward. You don't
even need to calculate all the lines, just do a bilinear interpolation
at the one (or few) locations where you need to. I'm sure you know
how to do bilinear interpolation. Since it sounds like you don't
really know what you want then you probably don't care too much about
the finer points about which method to use or the results, so why
don't you just use bilinear interpolation (the easiest way) and see
how that goes? If you don't like what it does for you, then you can
try something more sophisticated. (Actually polyfit,polyval is also
easy - just two lines, and probably even easier since you don't need
to find out which array elements you need to bilinear interpolate
between).
Regards,
ImageAnalyst

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