x=input('x=');
y=input('Y=');
subplot(4,1,1);
plot(x,y,'r*');
xlabel('x-Values')
ylabel('Y-Values')
n=length(x);
j=1;
i=1;
k=1;
while j<n
for i=i:n-1
e_dis=sqrt(((x(i+1)-x(j)).^2)+((y(i+1)-y(j)).^2));
d(k)=e_dis; %#ok<AGROW>
k= k+1;
end
j=j+1;
i=j;
end
display(d);
m=min(d);
display('Minimum Distance is');
display(m)
subplot(4,1,2)
Y = pdist(x,'cityblock');
Z = linkage(d,'complete');
[H, T] = dendrogram(Z);
xlabel(' complete_link Dendrogram');
subplot(4,1,3)
Y = pdist(x,'cityblock');
Z = linkage(d,'Average');
[H, T] = dendrogram(Z);
xlabel('Average Link_Dendrogram');
subplot(4,1,4)
Y = pdist(x,'cityblock');
Z = linkage(d,'single');
[H, T] = dendrogram(Z);
xlabel(' Single Link_Dendrogram');
0 comments:
Post a Comment