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

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

Sign in to comment.

Accepted Answer

Hernia Baby
Hernia Baby on 17 Aug 2021
Edited: Hernia Baby on 17 Aug 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 Comment
光貴 川島
光貴 川島 on 31 Aug 2021
ありがとうございます!遅くなってしまい申し訳ありません。
できました!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!