How to compare two measurement datas from 2 different devices?

59 ビュー (過去 30 日間)
Jes
Jes 2025 年 9 月 26 日 12:50
コメント済み: Star Strider 2025 年 10 月 9 日 11:25
Hallo,
I have two different csv measurements(xyz) from 2 different devices. One is a device doing spiral scanning and other is an interferometer. Since both of the devices will give different xyz. I am scanning the same workpiece in both devices. In order to do better comparison, i believe i need xyz almost close to each other for the devices,so how can i do it? Is the interpolation over common grid (x,y) works or is there any other better options?

回答 (1 件)

Star Strider
Star Strider 2025 年 9 月 26 日 13:27
It would help to have the data, or at least a representative sample of it.
Without knowing more, I would create a grid over the dimensions of the (x,y) plane that included all those data, so the minimum of both the x-coordinates to the maximum of the both x-coordinates, and the same of the y-coordinates. You can create those grids using the ndgrid funciton. Then create surfaces of the data using the scatteredInterpolant function, and then use the ndgrid results to plot them.
That might go something like this --
x1 = linspace(1, 2, 10);
y1 = linspace(2, 3, 11);
z1 = randn(numel(x1), numel(y1));
x2 = linspace(2, 4, 12);
y2 = linspace(1, 5, 10);
z2 = randn(numel(x2), numel(y2));
[X1,Y1] = ndgrid(x1, y1);
figure
stem3(X1, Y1, z1, 'filled')
grid on
xlabel('X_1')
ylabel('Y_1')
zlabel('Z_1')
title('Data Set #1')
[X2,Y2] = ndgrid(x2, y2);
figure
stem3(X2, Y2, z2, 'filled')
grid on
xlabel('X_2')
ylabel('Y_2')
zlabel('Z_2')
title('Data Set #2')
FZ1 = scatteredInterpolant(X1(:), Y1(:), z1(:), 'nearest', 'none');
FZ2 = scatteredInterpolant(X2(:), Y2(:), z2(:), 'nearest', 'none');
x3 = linspace(min(min(x1),min(x2)), max(max(x1),max(x2)), 20);
y3 = linspace(min(min(y1),min(y2)), max(max(y1),max(y2)), 20);;
[X3,Y3] = ndgrid(x3, y3);
Z1i = FZ1(X3, Y3);
Z2i = FZ2(X3, Y3);
figure
stem3(X3, Y3, Z1i, 'filled', DisplayName='Z1i')
hold on
stem3(X3, Y3, Z2i, 'filled', DisplayName='Z2i')
hold off
grid on
legend(Location='best')
xlabel('X_3')
ylabel('Y_3')
zlabel('Z_3')
title('Data Sets Combined')
Much depends on your data and the result you want.
.
  15 件のコメント
Jes
Jes 2025 年 10 月 9 日 5:08

I have a doubt, is the interpolation on common grid x and y of interferometer works for sensor? Means is it possible to use the x and y of the interferometer to find the corresponding z of the sensor by interpolation? if it is not possible please correct me

Star Strider
Star Strider 約22時間 前
(1) Since .csv files are text files (or should be text files), see if you can open the .csv file in a text editor. Upload it here anyway to see if I can read it. Also, the .dat file may not be able to be uploaded here as a .dat file. Use the zip function to put it in a .zip file and then upload the .zip file. That should work. (I forgot to mention that earlier.)
(2) Interpolating to a common grid should work for any set of values from all instruments. The x and y coordinates should have the same units of measurement and approximately the same values, or a way to convert them to the same range of values. With a grid of appropriate resolution (high number of points) the interpolation should be nearly exact. It may not be as exact here because of the size and time constraints, however you will be able to use the working code to create your own high-resolution grid to get acceptable results.
.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by