Arec= U*S*V' // full recovery. // below by ... but it can be replaced by your data imshow(A); ... plot(yps);// you can see if there is a pattern in plot of yps. // results.
SJCIT
Scilab 5.3.3
Feb 2017
To see pattern in matrices and also SVD approx
nr=6 ny=4 A=10*rand(nr,ny) ; // generating random matrix A= int(pmodulo(A, 4) )+ones(nr,ny) // to conform to given 1 2 3 4 // SVD method [U,S,V]=svd(A) ; // S are eigen values Arec= U*S*V' // full recovery // below by choosing high magnitude eigen values S(1,1)S(2,2)..etc // first approx Ar1=S(1,1)*(U(:,1)*V(:,1)') //second approx Ar2=S(1,1)*(U(:,1)*V(:,1)') + S(2,2)*(U(:,2)*V(:,2)') // below full recovery S(1,1)*(U(:,1)*V(:,1)') + S(2,2)*(U(:,2)*V(:,2)') +S(3,3)*(U(:,3)*V(:,3)') +S(4,4)*(U(:,4)*V(:,4)') // To see if there is a repititive pattern // based on Lambert Zijp · see following q //How we calculate the periodicity (cycle) of Arnold scrambling of the digital image? // in RG //Shafali Agarwal 6.47 question //JSS Academy of Technical Education // as example a random pattern is chosen for A matrices // but it can be replaced by your data imshow(A); np=2 // number of random A matrices yps= zeros (nr,np); // to collect y axis projections for i=1:np A = zeros(nr, ny); A=10*rand(nr,4) ; A= int(pmodulo(A, 5)); imshow(A);// to see the image of random matrix yps(:,i) = sum(A,2);// proj each
A to yaxis
end ; // plot(yps);// you can see if there is a pattern in plot of yps // results A = 2. 0. 3. 3. 1. 1. 3. 2. 3. 1. 0. 1. 4. 2. 0. 0. 4. 1. 1. 0. 2. 0. 3. 0. //plot of Yaxis projection to visualize pattern
// SVD method of dimensionality reuuction -->// below by choosing high magnitude eigen values S(1,1)S(2,2)..etc --> -->// first approx -->Ar1=S(1,1)*(U(:,1)*V(:,1)') Ar1 = column 1 to 2 3.9333763 1.8179405 3.6588365 3.5007567 3.4009414 2.4353449
2.9430256 1.360217 2.7376098 2.6193315 2.5446479 1.8221705
column 3 to 4 2.8823227 1.3321611 2.6811438
3.2548846 1.504353 3.0277018
2.5653051 2.4921619 1.7845864
2.8968901 2.8142926 2.0152576
-->//second approx -->Ar2=S(1,1)*(U(:,1)*V(:,1)') + S(2,2)*(U(:,2)*V(:,2)') Ar2 = column 1 to 2 4.3803345 2.0711311 3.4892524 2.7472847 3.9538251 2.0902346
3.5557076 1.7072861 2.5051471 1.5864861 3.3025306 1.3490997
column 3 to 4 1.8883451 0.7690977 3.0582771 4.24093 1.2626196 2.5520674
3.0409817 1.3831823 3.1088605 3.2574828 2.5496964 2.1804187
--> -->// below full recovery --> -->S(1,1)*(U(:,1)*V(:,1)') + S(2,2)*(U(:,2)*V(:,2)') +S(3,3)*(U(:,3)*V(:,3)') +S(4,4)*(U(:,4)*V(:,4)') ans = 4. 2. 4. 2. 4. 3.
4. 2. 2. 2. 3. 1.
2. 1. 3. 4. 1. 3.
3. 1. 3. 4. 3. 1.