周期性の無い3次元の点を繋ぎ合わせたグラフと平面(例えばY=0)の交点の座標を調べる方法はありませんか?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ryouga Kojima
le 12 Jan 2023
Commenté : Ryouga Kojima
le 16 Jan 2023
matlabで周期性の無い3次元の点を繋ぎ合わせたグラフと平面(例えばY=0)の交点の座標を調べる方法はありませんか? 例えを使って簡単に説明すると、Y=0の平面とあるグラフの交点を取りたいのですが、そのグラフではY=0の所に点がある訳ではなく、Y=-5とY=5にある点同士が繋がってる(線形補間?)感じです。
スプライン補完などでできるのでしょうか?
0 commentaires
Réponse acceptée
交感神経優位なあかべぇ
le 16 Jan 2023
Modifié(e) : 交感神経優位なあかべぇ
le 16 Jan 2023
おそらくあまり単純にはできず、地味に計算していくしかなさそうですね……。
下記は2次元の例(X = 0.5の場合のYデータの計算)ですが、このようなことを3次元でやらないといけないと思います。
x = [-2,-1,1,-1.5,5,6];
y = 0:5;
plot(x,y);
hold on;
crossX = 0.5;
xline(crossX);
over0 = x > crossX;
flg = over0(1);
crossIdx = [];
for idx = 2 : length(over0)
if flg && ~over0(idx)
crossIdx(end + 1) = idx;
flg = false;
elseif ~flg && over0(idx)
crossIdx(end + 1) = idx;
flg = true;
end
end
crossY = zeros(1, length(crossIdx));
for idx = 1 : length(crossIdx)
i = crossIdx(idx);
slope = (y(i) - y(i - 1)) / (x(i) - x(i - 1));
crossY(idx) = slope * (crossX - x(i - 1)) + y(i - 1);
end
crossY
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur スプライン dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!