07.12.2012 Views

ECONOMETRIC METHODS II TA session 1 MATLAB Intro ...

ECONOMETRIC METHODS II TA session 1 MATLAB Intro ...

ECONOMETRIC METHODS II TA session 1 MATLAB Intro ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ECONOMETRIC</strong> <strong>METHODS</strong> <strong>II</strong> <strong>TA</strong> Session 1<br />

diff=max(max(abs(Cap_Sigma1-Cap_Sigma0)));<br />

diff1=[diff1,diff];<br />

figure(2)<br />

plot(diff1)<br />

title(’Evolution of convergence’,’FontSize’,14)<br />

end<br />

sprintf(’Convergence achieved after %d iterations’,iter)<br />

% Alternatively, solve the discrete Lyapunov equation<br />

Cap_Sigma1l=dlyap(F,Q);<br />

% Compare results<br />

diff2=max(max(abs(Cap_Sigma1l-Cap_Sigma1)));<br />

toc<br />

Figure 3.2 shows that convergence is roughly achieved after iterating this equation<br />

7 times. However, since we impose a convergence criteria of " = 1 10 10 , the loop<br />

converges after 20 iterations. Moreover, in this application di¤2 is less than 1 10 10 ,<br />

which shows that the loop produces a good approximation. We now proceed to the next<br />

section for a more interesting analysis.<br />

Figure 3.2: Evolution of convergence of Y<br />

Fernando Pérez Forero 8

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!