How it changes the the resulting figure?
3 views (last 30 days)
Show older comments
Hello.
I wrote a code that makes a 2d embedding from the columns of P to the first 2 non trivial eigenvectors and works fine.
Now I need to recreate this embedding but after subtracting the mean of all columns of P. I tried the following
but I know that it recreates the same figure as my first one and verified that. So how subtracting the mean should affect the embedding?
theta=0:2*pi/1023:2*pi;
t=-1.5:3/511:1.5;
P=shepp_logan_proj_2(theta,t);
C=(1/size(P,2))*sum(P,2);
X=zeros(size(P,1),size(P,2));
for i=1:size(P,2)
X(:,i)=P(:,i)-C;
end
epsilon=0.5;
W=zeros(size(P,2),size(P,2));
for i=1:size(P,2)
for j=1:size(P,2)
W(i,j)=exp(-norm(X(:,i)-X(:,j)).^2/(2*epsilon));
end
end
a=(sum(W,2))';
D=zeros(size(W,1),size(W,2));
for k=1:size(W,2)
D(k,k)=a(k);
end
A=inv(D)*W;
S=D^(-0.5)*W*D^(-0.5);
[U,G]=eig(S);
V=D^(-0.5)*U;
c=sort(diag(G),'descend');
cc=1/size(P,2)*sum(V,2);
figure(1);
hold on
clf;
scatter(P(:,1),P(:,2));
xlabel('\itx');
ylabel('\ity');
axis equal;
axis tight;
figure(2);
clf;
scatter(V(:,2),V(:,3),5,theta)
xlabel('\phi_1')
ylabel('\phi_2')
set(get(gca,'XLabel'),'FontSize',12)
set(get(gca,'YLabel'),'FontSize',12)
axis equal;
axis tight;
Thanks in advance!
0 Comments
Answers (0)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!