a=1.05; b=0.01; q=1000; r=10; x0=10; sN=50; N=1000; [x,u,K,S]=scaopt(a,b,q,r,sN,x0,N); k=1:N; subplot(1,3,1) plot(k,S(1:end-1),'.-'); set(gca,'FontSize',12) xlabel('k','FontSize',12) ylabel('s_k','FontSize',12) subplot(1,3,2) plot(k,K,'.-') set(gca,'FontSize',12) xlabel('k','FontSize',12) ylabel('K_k','FontSize',12) subplot(1,3,3) plot(k,x(1:end-1),'.-') set(gca,'FontSize',12) xlabel('k','FontSize',12) ylabel('x_k','FontSize',12) %print -depsc2 ../lectures/figures/scaopt_outputs.eps %!epstopdf ../lectures/figures/scaopt_outputs.eps