load lincoln_eighth_circuit_time.dat prox = lincoln_eighth_circuit_time tic; n = 14; best_vaf = 0.0; store_vaf = zeros(100,1); for i = 1:100 [outpermone,outpermtwo,coordone,coordtwo,fitone,fittwo,addconone,... addcontwo,vaf] = ms_biscalqa(prox,targlin(n),targlin(n), ... randperm(n),randperm(n),3,1); store_vaf(i) = vaf; if (vaf > best_vaf) best_vaf = vaf; best_outpermone = outpermone; best_outpermtwo = outpermtwo; best_coordone = coordone; best_coordtwo = coordtwo; best_fitone = fitone; best_fittwo = fittwo; best_addconone = addconone; best_addcontwo = addcontwo; end end sorted_vafs = sort(store_vaf'); sorted_vafs best_vaf best_outpermone best_outpermtwo best_coordone best_coordtwo best_addconone best_addcontwo axes = zeros(n,2); for i = 1:n axes(best_outpermone(i),1) = best_coordone(i); axes(best_outpermtwo(i),2) = best_coordtwo(i); end figure(1) plot(axes(1:n,1),axes(1:n,2),'ko') hold on for i = 1:n objectlabels{i,1} = int2str(i); end text(axes(1:n,1),axes(1:n,2),objectlabels,'fontsize',10,'verticalalignment','bottom') title('City-Block Scaling of the Eighth Circuit Based on the MapQuest Time Data') toc; cityblock_coordinates = axes; tic; opts = statset('Maxiter',1000); best_vaf = 0.0; store_vaf = zeros(100,1); for k = 1:100 [coords,stress] = mdscale(prox,2,'Criterion','metricstress', 'Start',... 'random','Replicates',1,'Options',opts); n = size(coords,1); distance_matrix = zeros(n,n); for i = 1:n for j = 1:n distance_matrix(i,j) = sqrt(((coords(i,1) - coords(j,1))^2) + ... ((coords(i,2) - coords(j,2))^2)); end end ave_diff = (sum(sum(prox - distance_matrix)))/(n*(n-1)); ave_proximity = (sum(sum(prox)))/(n*(n-1)); prox_vec = squareform(prox); distance_vec = squareform(distance_matrix); r = corrcoef(prox_vec',distance_vec'); vaf = r(1,2)^2; store_vaf(k) = vaf; if(vaf > best_vaf) best_vaf = vaf; best_coords = coords; end end store_vaf; sorted_vafs = sort(store_vaf'); sorted_vafs best_vaf best_coords figure(2) axis equal plot(best_coords(:,1),best_coords(:,2),'ko') hold on for i = 1:n objectlabels{i,1} = int2str(i); end text(best_coords(:,1),best_coords(:,2),objectlabels,'fontsize',10,'verticalalignment','bottom') title('Euclidean Scaling of the Eighth Circuit Based on the MapQuest Time Data') toc; euclidean_coordinates = [best_coords(:,1),best_coords(:,2)]; [d,z,transform] = procrustes(cityblock_coordinates,euclidean_coordinates); figure(3) plot(cityblock_coordinates(:,1),cityblock_coordinates(:,2),'rx',... euclidean_coordinates(:,1),euclidean_coordinates(:,2),'b.',... z(:,1),z(:,2),'ko') legend({'City-Block','Euclidean','Transformed Euclidean'},'Location','Northwest') title('Procustean Tranformation of the Euclidean Scaling to the City-Block Coordinates') hold on text(cityblock_coordinates(:,1),cityblock_coordinates(:,2),objectlabels,'fontsize',8,'verticalalignment','bottom') text(z(:,1),z(:,2),objectlabels,'fontsize',8,'verticalalignment','bottom') transform(1).b transform(1).T transform(1).c load eighth_circuit_coordinates.dat lat_long_coordinates = eighth_circuit_coordinates [d,z,transform] = procrustes(lat_long_coordinates,euclidean_coordinates); figure(4) plot(lat_long_coordinates(:,1),lat_long_coordinates(:,2),'rx',... euclidean_coordinates(:,1),euclidean_coordinates(:,2),'b.',... z(:,1),z(:,2),'ko') legend({'lat_long','Euclidean','Transformed Euclidean'},'Location','Northwest') title('Procrustean Transformation of the Euclidean Scaling to the Latitude and Longitude Coordinates') hold on text(lat_long_coordinates(:,1),lat_long_coordinates(:,2),objectlabels,... 'fontsize',8,'verticalalignment','bottom') text(z(:,1),z(:,2),objectlabels,'fontsize',8,'verticalalignment','bottom') transform(1).b transform(1).T transform(1).c figure(5) [correlations,regression_coeff,property_angles,axes_deviated,properties_deviated,... predicted properties] =