ヒートマップに関して
3 views (last 30 days)
Show older comments
cdata = [肩の角度,肘の角度,sin(肩の角度ー肘の角度)×cos(肩の角度ー肘の角度)]
が417×3の行列になっており,横軸を肩の角度,縦軸を肘の角度にしたときに,sin(肩の角度ー肘の角度)×cos(肩の角度ー肘の角度)の値に対してヒートマップを作成したいのですが,どのように直せば良いでしょうか
global uLink
global fname
global s%フレームの始まり
global f%フレームの終わり
s = 1300;
f = 1400;
fname = 'xsens.xlsx'
uLink(2).angle = resample_ZXY(2)
uLink(3).angle = resample_ZXY(3)
l = size(uLink(2).angle(:,2),1);
for i = 1:l
m(i) = sin(uLink(2).angle(i,2)-uLink(3).angle(i,3))*cos(uLink(2).angle(i,2)-uLink(3).angle(i,3))
end
cdata = [uLink(2).angle(:,2),uLink(3).angle(:,3),m]
imagesc(0:10:90,180:-20:0,cdata);
colormap hot;
colorbar;
axis xy;
daspect([1 1 1]);
関節角度の呼び出し関数
function angle = resample_ZXY(fname,j)
global s
global f
ang = readtable(fname,"Sheet","Joint Angles ZXY");
ang = ang(s:f,:);
if j==0
angle = 0;
elseif j==2
%shoulder
%original
ori_abd = ang.RightShoulderAbduction_Adduction;
ori_IE = ang.RightShoulderInternal_ExternalRotation;
ori_FE = ang.RightShoulderFlexion_Extension;
%resample
abd = interp1(ori_abd, 1:240/1000:length(ori_abd),"spline");
IE = interp1(ori_IE, 1:240/1000:length(ori_IE),"spline");
FE = interp1(ori_FE, 1:240/1000:length(ori_FE),"spline");
angle = [abd',IE',FE'];
elseif j==3
%elbow
%original
ori_EU = ang.RightElbowUlnarDeviation_RadialDeviation;
ori_PS = ang.RightElbowPronation_Supination;
ori_FE = ang.RightElbowFlexion_Extension;
%resample
EU = interp1(ori_EU, 1:240/1000:length(ori_EU),"spline");
PS = interp1(ori_PS, 1:240/1000:length(ori_PS),"spline");
FE = interp1(ori_FE, 1:240/1000:length(ori_FE),"spline");
angle = [EU',PS',FE'];
end
0 Comments
Answers (1)
Atsushi Ueno
on 29 Dec 2023
下記箇所で、変数mを初期化せずに要素を追加しています。
その結果、m は 1 行 417 列の行ベクトルになり、uLink(n).angle(:,m) (417 行 1 列)とサイズが揃いません。
l = size(uLink(2).angle(:,2),1);
for i = 1:l
m(i) = sin(uLink(2).angle(i,2)-uLink(3).angle(i,3))*cos(uLink(2).angle(i,2)-uLink(3).angle(i,3))
end
m = sin(uLink(2).angle(:,2)-uLink(3).angle(:,3)) .* cos(uLink(2).angle(:,2)-uLink(3).angle(:,3));
0 Comments
See Also
Categories
Find more on データ分布プロット in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!