Multiplying matrices and vectors in loop
1 次查看(过去 30 天)
显示 更早的评论
This is the part of the code I want to solve but it gives me error, says that the matrix size are not the same but they are all 3 x 3. Do I need a for loop maybe? Can you help with it?
clear all, clc; H=1700 %height
dSG=0.129*H;
dH=0.185*H;
dF=0.146*H;
FiA = -10:20:170 ;
FiFm = -60:10:170 ;
FiRm=-60:20:90;
FiEF=-90:20:60;
COSA=cosd(FiA);
SINA=sind(FiA);
RA = arrayfun( @(sinFif, cosFif) [cosFif 0 sinFif; 0 1 0; -sinFif 0 cosFif], SINA, COSA, 'uniform', 0)
CA=cell2mat(RA)
COSE=cosd(FiEF);
SINE=sind(FiEF);
RE = arrayfun( @(sinFif, cosFif) [cosFif 0 sinFif; 0 1 0; -sinFif 0 cosFif], SINE, COSE, 'uniform', 0)
CE=cell2mat(RE)
[gFiA, gFiFm] = ndgrid(FiA, FiFm);%you want all combinations
gFiF = gFiFm + gFiA / 3 ;
COSF = cosd(gFiF); %cosd and sind because you are working in degrees !
SINF = sind(gFiF );
RF = arrayfun( @(sinFif, cosFif) [1 0 0; 0 cosFif -sinFif; 0 sinFif cosFif], SINF, COSF, 'uniform', 0)
CF=cell2mat(RF)
rSG=[-dSG 0 0]'; %shoulder joint - torso
rH=[0 0 -dH]' ;% upper arm
rF=[0 dF 0]';%fore arm
rW=rSG+CA*CF*rH+CE*rF
0 个评论
采纳的回答
KL
2017-12-14
they are all 3 x 3...
No, they are not. Check the output for the following
size(CA)
size(CF)
and the other matrices you have.
Just copy-pasting the code doesn't help either. What exactly do you want to do?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cast and Quantize Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!