The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Interpolate the z value
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Tin Tin

Vietnam
7 Posts

Posted - 02/05/2012 :  7:32:11 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver.8.5.1

Hi everyone,

Im using Originpro 8.5.1, and I have one question, can anyone please help me.

I have a table like this with a set of data (x,y - coordinate, z - velocity) and other values of (x,y). you can check the picture in the following link:
http://www.mediafire.com/imgbnc.php/1f3a98754836264f5a1ec38175dc248733070579dcfc25c43d8b566215f74d515g.jpg

My problem is that I want to interpolate the z values of (x,y) from that set of data. Can we do that in origin?

Thank you so much

Tin Tin

Vietnam
7 Posts

Posted - 02/05/2012 :  7:55:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
P.S: Note that the set of data (x,y,z) looks like a grid, but actually it is not. So I can not choose the the number of cols or rows, first X, first Y, etc if I use 2D interpolate.
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 02/06/2012 :  4:18:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Tin Tin,

Probably other people have better ideas, but here is what I think.

I think it's a gridding problem, and there is no single "interpolation" method, but many gridding algorithms - depending on the algorithm and its parameters, you may get different result.

Using any gridding method, you can convert your XYZ data to a matrix with enough columns and rows to have sufficient precision for you. You can change the matrix display mode to XY Coordinates mode by choosing "View: Show XY" menu. Then, you can read out the Z value of the cell with the closest corresponding XY coordinates. (This part may be done in a smarter way. Also, compare the XYZ contour and the matrix's contour how satisfactory the gridding by the algorithm resulted.)
Is someone who has better idea?

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 02/06/2012 4:19:47 PM
Go to Top of Page

Tin Tin

Vietnam
7 Posts

Posted - 02/06/2012 :  7:38:54 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Hideo Fujii,

Sorry but I have to say that I actually do not understand your method. (Im quiet new to Origin)

After converting the set of data (x,y,z) to matrix. Then use ANALYSIS > MATHEMATICS > 2D INTERPOLATE, we have the number of rows, cols, first & last x, fist & last y. But where can we input the value of (x,y) used to interpolate the z values. I wanna interpolate the z-value of this (x,y)?

Can you please help me, because im really in a hurry.

Thank you so much Hideo
Go to Top of Page

Tin Tin

Vietnam
7 Posts

Posted - 02/06/2012 :  7:49:22 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Okay, I understand what you mean. You mean that I have to compare the (x,y) to choose the value that i need. Right? But in case I have a lot of nodes, for example 1000 nodes, how can I just compare manually. It really takes time.

Thank you Hideo
Go to Top of Page

Drbobshepherd

USA
Posts

Posted - 02/07/2012 :  3:10:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Sad, but Origin does not seem to have a 2D lookup table function for real values of x and y, just indeces. After creating Hideo's z-matrix gridded to the desired accuracy, you could try this:

1. Convert the z-matrix back to a worksheet; set direct method, y across cols, x-values in col 1, y-values in system parameters.

2. Copy Parameter label row to Long Name label row.

3. Now you can find the z-value for any cell in the new worksheet using col(y-value)(x-value). Note: y-value will be treated as a string so it must match the column long name exactly. However, the x-value does not have to be exact; it will be interpolated.

I only suggest this as a quick fix. If time would allow it, I think it would be better if you programmed your own table-lookup function that would find z(x,y) in your gridded matrix.

DrBobShepherd
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 02/07/2012 :  3:43:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
DrBobShepherd, 

Yes, and I will suggest our developers to consider the 2D lookup table. 
Thank you for pointing out.

Tin Tin, 

Meanwhile, you can define the following LabTalk function in "Before Formula Script" 
in the Set Column Values tool, and run the function with given X and Y columns: 

////////////////////////////////
range mm = [MBook1]MSheet1!1;
function double zatxy(range mm, double xx, double yy) {
  xinc=(mm.x2-mm.x1)/(mm.ncols-1);
  yinc=(mm.y2-mm.y1)/(mm.nrows-1);
  xxi=int((xx-mm.x1)/xinc)+1;
  yyi=int((yy-mm.y1)/yinc)+1;
  xxj=xxi+1;
  yyk=yyi+1;
  xi=mm.x1+(xxi-1)*xinc;
  yi=mm.y1+(yyi-1)*yinc;
  xj=mm.x1+xxi*xinc;
  yk=mm.y1+yyi*yinc;
  zi=mm[yyi, xxi];
  zj=mm[yyi, xxj];
  zk=mm[yyk, xxi];
  t1=-(yk-yi)*(zj-zi)*(xi-xx);
  t2=-(zk-zi)*(xj-xi)*(yi-yy);
  t3=((xj-xi)*(yk-yi));
  zz = ( ( t1 + t2 ) / t3 ) + zi;
  return zz;
}
/////////////////////////



I hope I didn't make mistake. This script assumes the data points at neighboring 
four cells are on a same plane (as supposed to by the gridding). It also does 
only interpolation, no extrapolation. 

Good luck!

--Hideo Fujii
OriginLab

Go to Top of Page

Tin Tin

Vietnam
7 Posts

Posted - 02/08/2012 :  6:54:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Hideo Fujii and DrBobShepherd,

Thank you so much for your help.

I will follow your instruction and try to interpolate.

Regards,
Tin Tin
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000