m×n行列で表現される表面形状の形状偏差
Show older comments
下図のように2次元配列で表現された2つの表面形状の形状偏差を計算したいと考えています.
(偏差は「形状Aの頂点→形状Bの面」または「形状Aの頂点→形状Bの頂点」間の符号付距離を想定してます)
何か良い方法はありますでしょうか?

Accepted Answer
More Answers (1)
Hernia Baby
on 22 Mar 2022
Edited: Hernia Baby
on 22 Mar 2022
点数が一緒であるなら、三平方の定理は使えませんか?
clc,clear;
[X,Y,Z] = peaks(50);
X1 = X + 0.1*randi([-1 1],size(X));
Y1 = Y + 0.1*randi([-1 1],size(Y));
Z1 = Z;
Z1(10:20,10:20) = Z1(10:20,10:20) + randi([-1,1],size(Z1(10:20,10:20)));
surf(X,Y,Z,'EdgeColor','none')
colormap('gray')
hold on
scatter3(X1,Y1,Z1,'red','x')
距離を算出して各格子点でどれだけ離れているかをプロットします
R = sqrt((X-X1).^2+(Y-Y1).^2+(Z-Z1).^2);
figure
surf(R,'EdgeColor','none')
view(2)
xlabel 'xの点数'
ylabel 'yの点数'
追記:符号
おそらくz軸で正負判定を決めているのでしょうか
それでしたら以下のようになります
R = R*sign(Z-Z1);
figure
surf(R,'EdgeColor','none')
view(2)
xlabel 'xの点数'
ylabel 'yの点数'
Categories
Find more on 基本的な多角形 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



