% plots 2d log log plots
clc;
clf;
close all;
f=7;
n=100:100:1500;

% n fixed and m is varied

h=figure(f+1);
hold on
loglog(n,t1(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,t2(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,t3(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
xlabel('n');
ylabel('Timings (s)');
title('Comparison of timings when r=10%')
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+2);
hold on
loglog(n,t1(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,t2(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,t3(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
xlabel('n');
ylabel('Timings (s)');
title('Comparison of timings when r=15%');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+3);
hold on
loglog(n,t1(3,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,t2(3,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,t3(3,:),'ks-','MarkerFaceColor','k','LineWidth',2);
xlabel('n');
ylabel('Timings (s)');
title('Comparison of timings when r=20%');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+4);
hold on
loglog(n,e1(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,e2(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,e3(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
xlabel('n');
ylabel('Accuracies (||U\SigmaV^{T}-A||_\infty)');
title('Comparison of accuracies when r=10%')
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+5);
hold on
loglog(n,e1(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,e2(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,e3(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
xlabel('n');
ylabel('Accuracies (||U\SigmaV^{T}-A||_\infty)');
title('Comparison of accuracies when r=15%');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+6);
hold on
loglog(n,e1(3,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,e2(3,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,e3(3,:),'ks-','MarkerFaceColor','k','LineWidth',2);
title('Comparison of accuracies when r=20%');
xlabel('n');
ylabel('Accuracies (||U\SigmaV^{T}-A||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+7);
hold on
loglog(n,orth1(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,orth3(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,orth5(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
title('Comparison of Orthogonality checks when r=10%');
xlabel('n');
ylabel('Orthogonality checks (||UU^{T}-Id||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+8);
hold on
loglog(n,orth1(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,orth3(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,orth5(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
title('Comparison of Orthogonality checks when r=15%');
xlabel('n');
ylabel('Orthogonality checks (||UU^{T}-Id||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+9);
hold on
loglog(n,orth1(3,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,orth3(3,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,orth5(3,:),'ks-','MarkerFaceColor','k','LineWidth',2);
title('Comparison of Orthogonality checks when r=20%');
xlabel('n');
ylabel('Orthogonality checks (||UU^{T}-Id||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+10);
hold on
loglog(n,orth1_1(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,orth3_1(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,orth5_1(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
title('Comparison of Orthogonality checks when r=10%');
xlabel('n');
ylabel('Orthogonality checks (||U^{T}U-Id||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+11);
hold on
loglog(n,orth1_1(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,orth3_1(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,orth5_1(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
title('Comparison of Orthogonality checks when r=15%');
xlabel('n');
ylabel('Orthogonality checks (||U^{T}U-Id||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+12);
hold on
loglog(n,orth1_1(3,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,orth3_1(3,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,orth5_1(3,:),'ks-','MarkerFaceColor','k','LineWidth',2);
title('Comparison of Orthogonality checks when r=20%');
xlabel('n');
ylabel('Orthogonality checks (||U^{T}U-Id||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+13);
hold on
loglog(n,orth2(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,orth4(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,orth6(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
title('Comparison of Orthogonality checks when r=10%');
xlabel('n');
ylabel('Orthogonality checks (||VV^{T}-Id||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+14);
hold on
loglog(n,orth2(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,orth4(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,orth5(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
title('Comparison of Orthogonality checks when r=15%');
xlabel('n');
ylabel('Orthogonality checks (||VV^{T}-Id||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+15);
hold on
loglog(n,orth2(3,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,orth4(3,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,orth6(3,:),'ks-','MarkerFaceColor','k','LineWidth',2);
title('Comparison of Orthogonality checks when r=20%');
xlabel('n');
ylabel('Orthogonality checks (||VV^{T}-Id||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+16);
hold on
loglog(n,orth2_1(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,orth4_1(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,orth6_1(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
title('Comparison of Orthogonality checks when r=10%');
xlabel('n');
ylabel('Orthogonality checks (||V^{T}V-Id||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+17);
hold on
loglog(n,orth2_1(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,orth4_1(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,orth5_1(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
title('Comparison of Orthogonality checks when r=15%');
xlabel('n');
ylabel('Orthogonality checks (||V^{T}V-Id||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+18);
hold on
loglog(n,orth2_1(3,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,orth4_1(3,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(n,orth6_1(3,:),'ks-','MarkerFaceColor','k','LineWidth',2);
title('Comparison of Orthogonality checks when r=20%');
xlabel('n');
ylabel('Orthogonality checks (||V^{T}V-Id||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+19);
hold on
loglog(n,esval1(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,esval2(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
title('Comparison of errors in singular values when r=10%');
xlabel('m');
ylabel('Errors in singular values (||Computed-Actual||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+20);
hold on
loglog(n,esval1(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,esval2(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
title('Comparison of errors in singular values when r=15%');
xlabel('m');
ylabel('Errors in singular values (||Computed-Actual||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+21);
hold on
loglog(n,esval1(3,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(n,esval2(3,:),'g^-','MarkerFaceColor','g','LineWidth',2);
title('Comparison of errors in singular values when r=20%');
xlabel('m');
ylabel('Errors in singular values (||Computed-Actual||_\infty)');
legend('Built-in function', 'Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');