Using a for loop to create multiple rotation matrices
5 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Matt J
on 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 Comments
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!