Multiplying matrices and vectors in loop
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
KL
il 14 Dic 2017
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?
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!