Multiplying matrices and vectors in loop
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Parallel Computing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!