In MATLAB, we can use while loop to compute matrix H.
Here I will introduce how to use while in MATLAB. In fact, I strongly recommend you to check the document in MATLAB for help.
The structure of a while loop as follow:
WHILE expression
statements
END
If this condition in expression part holds, the program will repeat statements an indefinite number of times.
In that case of Binder-Pesaran Method, you can compute first 100 elements of H, then use while loop as:
B=F^100*G*D^100;
while max(max(abs(B)))>10^-6;
B=F*B*D;
H=H+B;
end;
something like that could get H.
And you may need "for loop" to compute first 100 elements of H. It is not big problem since you have done Problem Set 2.
沒有留言:
張貼留言