Author |
Topic |
|
Tin Tin
Vietnam
7 Posts |
|
Tin Tin
Vietnam
7 Posts |
Posted - 02/05/2012 : 7:55:56 PM
|
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. |
|
|
Hideo Fujii
USA
1582 Posts |
Posted - 02/06/2012 : 4:18:19 PM
|
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 |
|
|
Tin Tin
Vietnam
7 Posts |
Posted - 02/06/2012 : 7:38:54 PM
|
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 |
|
|
Tin Tin
Vietnam
7 Posts |
Posted - 02/06/2012 : 7:49:22 PM
|
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 |
|
|
Drbobshepherd
USA
Posts |
Posted - 02/07/2012 : 3:10:19 PM
|
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
|
|
|
Hideo Fujii
USA
1582 Posts |
Posted - 02/07/2012 : 3:43:43 PM
|
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
|
|
|
Tin Tin
Vietnam
7 Posts |
Posted - 02/08/2012 : 6:54:04 PM
|
Dear Hideo Fujii and DrBobShepherd,
Thank you so much for your help.
I will follow your instruction and try to interpolate.
Regards, Tin Tin |
|
|
|
Topic |
|
|
|