作成した単位ベクトル同士の関係を視覚的に確認する方法
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
光貴 川島
am 17 Aug. 2021
Kommentiert: 光貴 川島
am 31 Aug. 2021
膝の屈曲角度を単位ベクトル同士の角度(内積)で求めたのですが、角度が60~80度になり、明らかに動作時の角度より大きく計算されてしまいました。
ベクトル同士がしっかり計算されているか見るためにplot3で3次元グラフにしてみたいのですがどうすればよいのでしょうか?
このコードで確認すると写真のようにグラフが表示されます。
thighはそれぞれx、y、zの単位ベクトルになります。
plot3(thigh_x(i,:),thigh_z(i,:),thigh_y(i,:));
2 Kommentare
Akzeptierte Antwort
Hernia Baby
am 17 Aug. 2021
Bearbeitet: Hernia Baby
am 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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu ライン プロット finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!