"Eugene" wrote in message <firstname.lastname@example.org>... > % rotation angle > a = degtorad(45.0); > %rotation matrix (around X axis) > MX = [1.0 0.0 0.0; > 0.0 cos(a) -sin(a); > 0.0 sin(a) cos(a)]; > %source point coords > x = 0.5 > y = 0.5 > z = 0.7071 > > % plot source point > plot3(x,y,z,':go');grid on; > hold on; > %plot radius-vector to source pt > line([0 x],[0 y],[0 z],'color','g'); > > % rotation > new_pt = MX * [x; y; z] > > % plot destination point > x = new_pt(1,1); y = new_pt(2,1); z = new_pt(3,1); > plot3(x, y, z,':ro'); > %plot radius-vector to destination pt > line([0 x],[0 y],[0 z],'color','r'); > > I have source point [0.5 0.5 0.7071], after rotation- [0.5 -0.1464 0.8535] > But it is incorrect answer! > It seems to me y value can't be negative and z also has invalid value. > What's wrong in my solution? - - - - - - - - - That rotation looks valid to me. You have rotated the point counterclockwise from the y-axis toward the z-axis by 45 degrees. The point (.5,.5,.7071) should end up at (.5,-.1464,.8535) just where you have it. Why don't you think that is right? The original point was more than 45 degrees from the y-axis, so after 45 degrees more it would rotate past the z-axis and produce a negative y. Were you expecting a rotation in the opposite direction? If so, your MX would be incorrect.