Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function []=plotdigit(A)
- % Translate vector to become nonnegative
- % Scale to interval [0,20]
- % Reshape the vector as a matrix and then show image
- a1=squeeze(A);
- a1=reshape(a1,16,16)';
- minval=-1; maxval=1;
- % Rescale
- a1=-a1;
- a1=(a1-minval*ones(size(a1)));
- len=200;
- a1=(len/maxval)*a1/2;
- max(max(a1))
- min(min(a1))
- mymap1=(linspace(0,1,len))'*[1,1,1];
- %mymap1 =[1.0000 1.0000 1.0000
- % 0.8715 0.9028 0.9028
- % 0.7431 0.8056 0.8056
- % 0.6146 0.7083 0.7083
- % 0.4861 0.6111 0.6111
- % 0.3889 0.4722 0.5139
- % 0.2917 0.3333 0.4167
- % 0.1944 0.1944 0.3194
- % 0.0972 0.0972 0.1806
- % 0 0 0.0417];
- colormap(mymap1);
- image(a1)
- x = C\testdata;
- b = C*x;
- subplot(2,2,1), plotdigit(b(:,26)), title('kolumn 2');
- subplot(2,2,2), plotdigit(testdata(:,26), title('kolumn 3'));
- %i våran matris C så vill vi ta första kolumnen för att testa dne mot
- %plotdigit för att se hur den ser ut.
- %{
- tva = C(:,2);
- tre = C(:,3);
- fem = C(:,5);
- fyra = C(:,4);
- sex = C(:,10);
- sju = C(:,15);
- atta = C(:,25);
- nio = C(:,35);
- tio = C(:,45);
- subplot(3,3,1), plotdigit(tva), title('kolumn 2')
- subplot(3,3,2), plotdigit(tre), title('kolumn 3')
- subplot(3,3,3), plotdigit(fyra), title('kolumn 4')
- subplot(3,3,4), plotdigit(fem), title('kolumn 5')
- subplot(3,3,5), plotdigit(sex), title('kolumn 10')
- subplot(3,3,6), plotdigit(sju), title('kolumn 15')
- subplot(3,3,7), plotdigit(atta), title('kolumn 25')
- subplot(3,3,8), plotdigit(nio), title('kolumn 35')
- subplot(3,3,9), plotdigit(tio),, title('kolumn 45')
- %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement