Using a for loop to create multiple rotation matrices
조회 수: 3 (최근 30일)
이전 댓글 표시
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
채택된 답변
Matt J
2019년 2월 4일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!