1*c4762a1bSJed Brownfontsize_labels = 14; 2*c4762a1bSJed Brownfontsize_grid = 12; 3*c4762a1bSJed Brownfontname = 'Times'; 4*c4762a1bSJed Brown 5*c4762a1bSJed Brownh = zeros(5,1); 6*c4762a1bSJed Browne = zeros(5,1); 7*c4762a1bSJed Brownhold off 8*c4762a1bSJed Brownclf 9*c4762a1bSJed Brownset(gca,'FontName',fontname) 10*c4762a1bSJed Brownset(gca,'FontSize',fontsize_grid) 11*c4762a1bSJed Brownset(gca,'FontSize',fontsize_labels) 12*c4762a1bSJed Brownfor i=1:5 13*c4762a1bSJed Brown E = 8*2^i; 14*c4762a1bSJed Brown syscommand = compose('./spectraladjointassimilation -ts_adapt_dt_max 3.e-3 -E %d -N 2 -ncoeff 5 -a .1 -tao_grtol 1.e-12 -tao_gatol 1.e-12 -tao_max_it 7',[E]) 15*c4762a1bSJed Brown [status,result] = system(syscommand{1}); 16*c4762a1bSJed Brown eval(result); 17*c4762a1bSJed Brown[m,n] = size(history); 18*c4762a1bSJed Brown h(i) = history(m,2); 19*c4762a1bSJed Brown e(i) = E; 20*c4762a1bSJed Brown if (mod(i,2) == 1) 21*c4762a1bSJed Brown yyaxis left 22*c4762a1bSJed Brown semilogy(history(:,1),history(:,2),'Markersize',6,'LineWidth',2); 23*c4762a1bSJed Brown ylabel('Analytic Error'); 24*c4762a1bSJed Brown yyaxis right 25*c4762a1bSJed Brown semilogy(history(:,1),history(:,3),'Markersize',6,'LineWidth',2); 26*c4762a1bSJed Brown ylabel('Objective function'); 27*c4762a1bSJed Brown hold on 28*c4762a1bSJed Brown end 29*c4762a1bSJed Brownend 30*c4762a1bSJed Brownlegend('16 elements','64 elements','256 elements','16 elements','64 elements','256 elements') 31*c4762a1bSJed Brownxlabel('Iteration') 32*c4762a1bSJed Brownprint('convergencestudy-h','-depsc'); 33*c4762a1bSJed Brown 34*c4762a1bSJed Brownhold off 35*c4762a1bSJed Brownclf 36*c4762a1bSJed Brownset(gca,'FontName',fontname) 37*c4762a1bSJed Brownset(gca,'FontSize',fontsize_grid) 38*c4762a1bSJed Brownset(gca,'FontSize',fontsize_labels) 39*c4762a1bSJed Brownloglog(e,h,'-+','Markersize',6,'LineWidth',2); 40*c4762a1bSJed Brownxlabel('1/h'); 41*c4762a1bSJed Brownylabel('Analytic Error'); 42*c4762a1bSJed Brownprint('convergencestudy-h-2','-depsc'); 43*c4762a1bSJed Brown 44*c4762a1bSJed Brown 45*c4762a1bSJed Brownclf 46*c4762a1bSJed Brownset(gca,'FontName',fontname) 47*c4762a1bSJed Brownset(gca,'FontSize',fontsize_grid) 48*c4762a1bSJed Brownset(gca,'FontSize',fontsize_labels) 49*c4762a1bSJed Brownh = zeros(4,1); 50*c4762a1bSJed Browne = zeros(4,1); 51*c4762a1bSJed Brownfor i=1:4 52*c4762a1bSJed Brown N = 1 + 3*i; 53*c4762a1bSJed Brown syscommand = compose('./spectraladjointassimilation -ts_adapt_dt_max 3.e-3 -E 8 -N %d -ncoeff 12 -a .1 -tao_grtol 1.e-12 -tao_gatol 1.e-12 -tao_max_it 20',[N]) 54*c4762a1bSJed Brown [status,result] = system(syscommand{1}); 55*c4762a1bSJed Brown eval(result); 56*c4762a1bSJed Brownhistory 57*c4762a1bSJed Brown e(i) = N; 58*c4762a1bSJed Brown [m,n] = size(history); 59*c4762a1bSJed Brown h(i) = history(m,2) 60*c4762a1bSJed Brown yyaxis left 61*c4762a1bSJed Brown semilogy(history(:,1),history(:,2),'Markersize',6,'LineWidth',2); 62*c4762a1bSJed Brown ylabel('Analytic Error'); 63*c4762a1bSJed Brown yyaxis right 64*c4762a1bSJed Brown semilogy(history(:,1),history(:,3),'Markersize',6,'LineWidth',2); 65*c4762a1bSJed Brown ylabel('Objective function'); 66*c4762a1bSJed Brown hold on 67*c4762a1bSJed Brownend 68*c4762a1bSJed Brownlegend('Order 4','Order 7','Order 10','Order 13','Order 4','Order 7','Order 10','Order 13') 69*c4762a1bSJed Brownxlabel('Iteration') 70*c4762a1bSJed Brownprint('convergencestudy-p','-depsc'); 71*c4762a1bSJed Brown 72*c4762a1bSJed Brownhold off 73*c4762a1bSJed Brownclf 74*c4762a1bSJed Brownset(gca,'FontName',fontname) 75*c4762a1bSJed Brownset(gca,'FontSize',fontsize_grid) 76*c4762a1bSJed Brownset(gca,'FontSize',fontsize_labels) 77*c4762a1bSJed Brownloglog(e,h,'-+','Markersize',6,'LineWidth',2); 78*c4762a1bSJed Brownxlabel('Polynomial order'); 79*c4762a1bSJed Brownylabel('Analytic Error'); 80*c4762a1bSJed Brownprint('convergencestudy-p-2','-depsc'); 81