datos = xlsread('FBKFChile.xlsx','Datos','A2:B57'); tiempo = datos(:,1); I = datos(:,2); T = length(I) K = zeros(T,1); K(1) = 30201645; delta = 0.05; for i=2:T K(i) = K(i-1) - delta*K(i-1) + I(i-1); end; plot(tiempo,K,'r'); title('Stock Real de Capital de Chile'); ylabel('Miles de Millones de Pesos Encadenados'); xlabel('Año'); set(gca,'FontSize',8); plot(tiempo,I,'b'); title('Formación Bruta de Capital Fijo en Chile'); ylabel('Miles de Millones de Pesos Encadenados'); xlabel('Año'); set(gca,'FontSize',8); clear all; T = 100; y = zeros(T,1); eps = zeros(T,1); phi = 0.9; prob = 0.5; y(1) = 0; for t=2:T if rand<=prob eps(t) = 1; else eps(t) = -1; end y(t) = phi*y(t-1)+eps(t); end plot(y); y = zeros(T,1); eps = zeros(T,1); for t=2:T a=rand; if a<=0.25 eps(t) = 1; elseif a<=0.5 eps(t) = 0.5; elseif a<=0.75 eps(t) = -0.5; else eps(t) = -1; end y(t) = phi*y(t-1)+eps(t); end plot(y); y = zeros(T,1); eps = zeros(T,1); for t=2:T eps(t)=0+2*randn(1,1); y(t) = phi*y(t-1)+eps(t); end plot(y); clear all; a = 10; b = 0.1; c = 2; d = 0.5; p = [a; b; c; d]; res_si = equilibrio(p,0); disp(res_si); res_si.EC res_ci = equilibrio(p,1); disp(res_ci); inc = 0.1; t = 0; q = 1; Imp = []; Rec = []; while q>=0 res = equilibrio(p,t); q = res.q; Rec = [Rec; res.EE]; Imp = [Imp; t]; t = t+inc; end plot(Imp,Rec,'r'); title('Curva de Laffer'); xlabel('Impuesto'); ylabel('Recaudación Fiscal'); a = 10; b = 0.1; c = [2 -10]; d = [0.5 1.4]; inc = 0.1; np = length(d); T = 200; Imp = zeros(T,np); Rec = zeros(T,np); for j = 1:np; p = [a; b; c(j); d(j)]; t = 0; for i=1:T; res = equilibrio(p,t); q = res.q; if q>=0; Rec(i,j) = res.EE; Imp(i,j) = t; else Rec(i,j) = 0; Imp(i,j) = t; end; t = t+inc; end; end; plot(Imp(:,1),Rec(:,1),'r',Imp(:,2),Rec(:,2),'b'); title('Curva de Laffer'); xlabel('Impuesto'); ylabel('Recaudación Fiscal'); legend('Oferta Elástica','Oferta Inelástica'); of1 = @(x) c(1) + d(1)*x; of2 = @(x) c(2) + d(2)*x; x = 0:0.1:25; po1 = of1(x); po2 = of2(x); plot(x,po1,'r',x,po2,'b'); title('Curva de Oferta'); xlabel('Cantidad'); ylabel('Precio'); legend('Oferta Elástica','Oferta Inelástica'); clear all; % Definición de parámetros a = 10; b = 0.6; c = 2; d = 1.6; alpha = 0.08; T = 40; init = 0.5; pstar = (a*d + c*b)/(b+d); disp('Precio de Equilibrio:'); disp(pstar); disp('Ajuste:'); disp(alpha*(d+b)/(d*b)); init*pstar p = zeros(T,1); p(1) = init*pstar; for i = 2:T; p(i) = p(i-1) + alpha*((d+b)/(d*b))*(pstar-p(i-1)); end; plot(p) alpha = 0.8; disp('Precio de Equilibrio:'); disp(pstar); disp('Ajuste:'); disp(alpha*(d+b)/(d*b)); p = zeros(T,1); p(1) = init*pstar; for i = 2:T; p(i) = p(i-1) + alpha*((d+b)/(d*b))*(pstar-p(i-1)); end; plot(p); alpha = 0.9; disp('Precio de Equilibrio:'); disp(pstar); disp('Ajuste:'); disp(alpha*(d+b)/(d*b)); p = zeros(T,1); p(1) = init*pstar; for i = 2:T; p(i) = p(i-1) + alpha*((d+b)/(d*b))*(pstar-p(i-1)); end; plot(p)