Afficher commentaires plus anciens
X軸2点とY軸2点、合計4点を通過する円を座標上に描く(プロットする)のに、最も最適な方法を教えてください。 このような円をZ軸上では水平で、高さの異なるものをひとつのグラフに収めて2Dでも3D でも見れたら良いと思います。
1 commentaire
Réponse acceptée
Plus de réponses (2)
Etsuo Maeda
le 6 Nov 2019
一般的にMathで解くならこうですかね。
clear; close all;
% set points [x y z]
p1 = [3 2 -1];
p2 = [1 3 -2];
p3 = [3 -1 -4];
p4 = [0 0 -2];
% set symbolic variables
syms x y z a b c r
% set equation for sphere
f = (x-a)^2 + (y-b)^2 + (z-c)^2 == r^2;
f1 = subs(f, [x, y, z], p1);
f2 = subs(f, [x, y, z], p2);
f3 = subs(f, [x, y, z], p3);
f4 = subs(f, [x, y, z], p4);
F = [f1; f2; f3; f4];
% solve equations
assume([a, b, c], 'real')
assume(r, 'positive')
sol = solve(F, [a, b, c, r]);
sol.a
sol.b
sol.c
sol.r
HTH
Saito
le 21 Nov 2019
0 votes
Catégories
En savoir plus sur Axis Labels dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!