Using a for loop to create multiple rotation matrices

4 Ansichten (letzte 30 Tage)
Casey O'Heran
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.

Akzeptierte Antwort

Matt J
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

Weitere Antworten (0)

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!

Translated by