This GUI can be used for tutorial purpose for demonstrating singular value decomposition on a 2by2 matrix. Users can input any 2by2 matrix 'A' and the direction of the 2by1 vector 'x'. The interface will then output the result of the vector 'Ax'. For a certain matrix 'A', choosing vector 'x' of different directions will result in different length of the vector 'Ax'. To get the maximum length of vector 'Ax', the direction of the input vector 'x' should be aligned with the first right singular vector of the matrix 'A'. On the contrary, if the input vector 'x' is in the direction of the the second right singular vector of the matrix 'A', then you will get minimum length of the vector 'Ax'.
To use this GUI, here are the steps:
(1) Open file 'demoforsvd.m' and click Run. (You need to put the other file 'demoforsvd.fig' in the same folder)
(2) Input the four elements for the matrix 'A' in the middle and click 'update'.
(3) Input the coordinates for the vector 'x' at the bottom left of the panel. Note that normalisation will be executed by the code.
(4) Click 'plot' to see the result.
(5) You can repeat (3)&(4) by trying out different vectors 'x'. Or, you can click 'clear' to remove all the existing results.
(1) The red dashed line on the left plot shows the direction of the first right singular vector for the matrix 'A' while the blue dashed line shows the direction of the second right singular vector for the matrix 'A'.
(2) The colour for one chosen vector 'x' will be the same as the colour for the corresponding vector 'Ax'. You can plot as many pairs of 'x' and 'Ax' as you want, since different pairs will be distinguished by different colours.