___________________________________________
scilab-4.0
Copyright (c) 1989-2006
Consortium Scilab (INRIA, ENPC)
___________________________________________
Startup execution:
loading initial environment
-->// create a 2x2 rotation matrix, given degrees
-->function [m] = rotation(d)
-->r = d * %pi / 180.0
-->m = [cos(r) sin(r); -sin(r) cos(r)]
-->endfunction
-->
-->// create a 2x2 scale matrix, given x and y scales
-->function [m] = scale(sx, sy)
-->m = [sx 0; 0 sy]
-->endfunction
-->
-->// example rotation matrix, by 45 degrees
-->rotation(45.0)
ans =
0.7071068 0.7071068
- 0.7071068 0.7071068
-->
-->// example scale matrix X*3 and Y*2
-->scale(3,2)
ans =
3. 0.
0. 2.
-->
-->// A is product of rotation and scale
-->A = rotation(45.0) * scale(3,2)
A =
2.1213203 1.4142136
- 2.1213203 1.4142136
-->
-->// factor a into U,S,V
-->[U,S,V] = svd(A)
V =
- 1. 0.
0. 1.
S =
3. 0.
0. 2.
U =
- 0.7071068 0.7071068
0.7071068 0.7071068
-->
-->// get product of U,S and transpose of V
-->U*S*V'
ans =
2.1213203 1.4142136
- 2.1213203 1.4142136
-->A
A =
2.1213203 1.4142136
- 2.1213203 1.4142136