作成した単位ベクトル​同士の関係を視覚的に​確認する方法

2 vues (au cours des 30 derniers jours)
光貴 川島
光貴 川島 le 17 Août 2021
Commenté : 光貴 川島 le 31 Août 2021
膝の屈曲角度を単位ベクトル同士の角度(内積)で求めたのですが、角度が60~80度になり、明らかに動作時の角度より大きく計算されてしまいました。
ベクトル同士がしっかり計算されているか見るためにplot3で3次元グラフにしてみたいのですがどうすればよいのでしょうか?
このコードで確認すると写真のようにグラフが表示されます。
thighはそれぞれx、y、zの単位ベクトルになります。
plot3(thigh_x(i,:),thigh_z(i,:),thigh_y(i,:));
  2 commentaires
Hernia Baby
Hernia Baby le 17 Août 2021
ちなみに、これは原点(0,0,0)が膝位置という認識でいいですか?
光貴 川島
光貴 川島 le 17 Août 2021
ありがとうございます。
原点(0,0,0)は大腿骨の内外側課の中点になります

Connectez-vous pour commenter.

Réponse acceptée

Hernia Baby
Hernia Baby le 17 Août 2021
Modifié(e) : Hernia Baby le 17 Août 2021
3点ずつとればいいかなと思っています。
汚いですが絵のように、1⇒2⇒3で線をつなぎます。
--------------------------------------------------------------------
まずは適当な単位行列を作ります
clc,clear,close all;
n = 50;
X = unitvector(rand(n,3));
Y = unitvector(rand(n,3));
原点を作成します
O = zeros(n,3);
n行分0.5秒ごとに画像を切り替えます
ここではパラパラ漫画みたいに実行できないので、i = 20の線を出します
i = 20;
A = [X(i,:);O(i,:);Y(i,:)];
line(A(:,1),A(:,2),A(:,3),'Marker','o','LineStyle','--')
view(45,45)
% for i = 1:length(O)
% A = [X(i,:);O(i,:);Y(i,:)];
% line(A(:,1),A(:,2),A(:,3))
% view(45,45)
% pause(0.5)
% close
% end
以下は単位行列を作る関数です
function UV = unitvector (V)
% UNITVECTOR Unit vectorization of the vector.
error (nargchk (1, 1, nargin));
if ~ isreal (V) error ('Vector must be a real array.'); end;
VS = ones(length(V(:,1)),1)*sqrt(sum(V.*V));
UV = V./VS;
end
  1 commentaire
光貴 川島
光貴 川島 le 31 Août 2021
ありがとうございます!遅くなってしまい申し訳ありません。
できました!

Connectez-vous pour commenter.

Plus de réponses (0)

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!