WN3dPlots.m 916 B

1234567891011121314151617181920212223242526
  1. %Inport the ClusteredDist file you whish to plot
  2. function WN3dPlots
  3. [FILEname,folderFILE]=uigetfile(); FindFILE=fullfile(folderFILE,FILEname);
  4. ClusteredDist=readmatrix(FindFILE);
  5. %Normalize data
  6. MIN=min(ClusteredDist);
  7. MAX=max(ClusteredDist);
  8. norm=(ClusteredDist-MIN)./(MAX-MIN);
  9. %Create 3D Plots Before Clustering
  10. figure('Name','3D Plot of Normalized Distances');
  11. scatter3(norm(:,2:2),norm(:,3:3),norm(:,4:4),20,'filled','LineWidth',3);
  12. colormap(jet); colorbar;
  13. xlabel('PCA1'); ylabel('PCA2');zlabel('PCA3');
  14. xticks(0.2:0.2:1);yticks(0.2:0.2:1);zticks(0.2:0.2:1);
  15. %Create 3D Plots after Clustering
  16. figure('Name','3D Plot of Clustered Data');
  17. scatter3(norm(:,2:2),norm(:,3:3),norm(:,4:4),20,ClusteredDist(:,17:17),'filled','LineWidth',3);
  18. colormap(jet); colorbar;
  19. xlabel('PCA1'); ylabel('PCA2');zlabel('PCA3');
  20. xticks(0.2:0.2:1);yticks(0.2:0.2:1);zticks(0.2:0.2:1);
  21. clear MAX MIN
  22. end