Issue in defining range and getting all possible iterations
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
clear all, close all, clc;
H=1700 %Height of person
dSG=0.129*H
dH=0.185*H
dF=0.146*H
%POSITION OF POINT IN SPACE
fiAm=0:20:180; % RANGE from -10 to 170 deg
COSAm=cosd(fiAm)
SINAm=sind(fiAm)
RAm=[COSAm 0 SINAm;0 1 0;-SINAm 0 COSAm] %Elevation through ABDUCTION-ADDUCTION - about axis y
fiFm=-60 % rotacija oko y ramenog zgloba - RANGE from -60 to 170
fiFmm=fiFm+fiAm/3
COSFmm=cosd(fiFmm)
SINFmm=sind(fiFmm)
RFm=[1 0 0;0 COSFmm -SINFmm;0 SINFmm COSFmm] % Evelation through FLEXION-EXTENSION - about axis x
fiRm=-60 % RANGE -60 to 170 deg
fiRmm=fiRm+7*fiAm/9-fiFmm/9
COSRmm=cosd(fiRmm)
SINRmm=sind(fiRmm)
RRmm=[COSRmm -SINRmm 0; SINRmm COSRmm 0;0 0 1] % Internal-external rotation - ybout axis z
fiEFm=-90; % RANGE from -90 until 60 deg
COSEFm=cosd(fiEFm)
SINEFm=sind(fiEFm)
REFm=[1 0 0; 0 COSEFm -SINEFm; 0 SINEFm COSEFm] %Elbow flexion -extension - about axis x
%segment vectors
rSG=[-dSG 0 0]'
rH=[0 0 -dH]'
rF=[0 dF 0]'
rWm=rSG+RRmm*RAm*RFm*rH+REFm*rF
plot3(rWm(1),rWm(2),rWm(3),'k+')
grid on;
Can you help me so I can get a number of iterations so I don't have to change by hand al possibilities of the range angles of fiAm, fiFm, fiRm and FiEFm. I wanted to change its range by 10 degrees and get a number of points in the space. Is it possible
1 commentaire
Guillaume
le 18 Déc 2017
Rather than putting a blank line between each line of code that hardly makes the code readable, paste your code, select it, then press the {}Code button. It will be a lot easier to read.
Réponse acceptée
Jan
le 18 Déc 2017
As far as I understand all you need is:
axes('NextPlot', 'add'); % see: hold('on')
...
%POSITION OF POINT IN SPACE
fiAm = 0:20:180; % RANGE from -10 to 170 deg ??? 0:20:180 is not "-10:10:170" ?!?
for fiFm = -60:10:170
for fiRm = -60:10:170
for fiEFm = -90:10:60
... Your computations here without redefining fiFm, fiRm, fiEFm
plot3(rWm(1), rWm(2), rWm(3), 'k+')
end
end
end
In your code fiAm is a vector, but you ask for a loop: If this is needed, simply add a "for" as in the other lines.
3 commentaires
Jan
le 21 Déc 2017
Modifié(e) : Jan
le 21 Déc 2017
Perhaps you do not want fiAm to be a vector? Then replace:
fiAm = 0:20:180; % RANGE from -10 to 170 deg ??? 0:20:180 is not "-10:10:170" ?!?
by
for fiAm = 0:20:180
...
end
Note: It is a good programming practice to use functions to keep the workspace clean. This is much better than the brutal clearing header "clear all, close all, clc;" . Especially clear all wastes time and energy, because it removes all functions from the RAM and reloading them from the slow disk takes time.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!