`for s = 1 : 4;
Aplha_x(s) = 2 * pi * (rand);
Aplha_y(s) = 2 * pi * (rand);
Aplha_z(s) = 2 * pi * (rand);
eul = [Aplha_z(s) , Aplha_y(s) , Aplha_x(s)];
rotm = eul2rotm (eul);
end `
答案 0 :(得分:2)
这是因为您每次迭代都会覆盖rotm。
您可以使用像元数组来存储每次迭代的矩阵,如下所示:
rotm_array = cell(4,1);
for s = 1 : 4
Aplha_x(s) = 2 * pi * (rand);
Aplha_y(s) = 2 * pi * (rand);
Aplha_z(s) = 2 * pi * (rand);
eul = [Aplha_z(s) , Aplha_y(s) , Aplha_x(s)];
rotm = eul2rotm (eul);
rotm_array{s} = rotm;
end
可以使用rotm_array {s}打印单个矩阵:
disp(rotm_array{1});