%% FIG_FIXEDPOINT.M
% Deterministic dynamics: fixed point and convergence intuition
% This script plots the mapping k_{t+1} = f(k_t) for the Solow model
% and shows the steady state as intersection with the 45-degree line.

clear; close all; clc;

%% Parameters
alpha = 0.4;      % capital share
s     = 0.3;      % savings rate
delta = 0.1;      % depreciation rate

%% Law of motion
f = @(k) s*k.^alpha + (1 - delta)*k;

% Capital grid
k = linspace(0, 8, 200);
k_next = f(k);

% Steady state
k_star = (s/delta)^(1/(1 - alpha));

%% Plot
figure;
plot(k, k_next, 'LineWidth', 2); hold on;
plot(k, k, '--k', 'LineWidth', 1.2);                     % 45° line
plot(k_star, k_star, 'or', 'MarkerFaceColor', 'r');      % steady state

xlabel('$k_t$','Interpreter','latex');
ylabel('$k_{t+1}$','Interpreter','latex');
title('Law of Motion and Steady State','FontWeight','normal');
legend('$k_{t+1}=f(k_t)$','$45^\circ$ line','Steady state',...
       'Interpreter','latex','Location','southeast');
grid on; box on;
set(gca,'FontSize',12);

%% Export figure
exportgraphics(gcf,'Figures/fig_fixedpoint.png','Resolution',300);