Using a for loop to create multiple rotation matrices
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Casey O'Heran
am 4 Feb. 2019
Beantwortet: Matt J
am 4 Feb. 2019
POV = [5;3;6];
Rtheta = [0.5;0.5]*(pi/180); %Roll angle
Ptheta = [0;0.5]*(pi/180); %Pitch angle
Htheta = [0;0]*(pi/180); %Head angle
I am trying to input the above matrices into a rotation matrix to form different rotation matrices based upon the above attitude angles.
for i = 1:1:length(Htheta);
Rot(i,:) = Rh(Htheta(i,:))*Rp(Ptheta(i,:))*Rr(Rtheta(i,:)); %Rot. matrix using attitude angles
POVrot = Rot(i)*POV;
end
Rh, Rp, and Rr are rotation matrix functions outside of the main script. The above for loop is me trying to create mutliple rotation matrices and apply each individual rotation matrix to a point (POV) based on the respective attitude angles. I have not been able to get it to work. Any guidance would be greatly appreciated.
0 Kommentare
Akzeptierte Antwort
Matt J
am 4 Feb. 2019
As cell?
for i = 1:1:length(Htheta);
Rot{i} = Rh(Htheta(i,:))*Rp(Ptheta(i,:))*Rr(Rtheta(i,:)); %Rot. matrix using attitude angles
POVrot{i} = Rot{i}*POV;
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!