function G = gdp_simulate(G0, g, sigma, T, seed)
% GDP_SIMULATE  Simulate GDP path with shocks over T periods.
%   G = GDP_SIMULATE(G0, g, sigma, T, seed) returns a column vector of
%   length T+1 with G(1) = G0.
%
%   Model: G(t+1) = G(t) * (1 + g + eps_t),  eps_t ~ N(0, sigma^2).
%   Optional: provide 'seed' for reproducibility.

    % --- Input checks (optional) ---
    % if ~isscalar(G0) || G0 <= 0, error('G0>0 required'); end
    % if ~isscalar(T)  || T < 1 || fix(T)~=T, error('T integer >= 1'); end

    % --- Optional reproducibility ---
    if nargin >= 5 && ~isempty(seed)
        rng(seed);    % set seed only if provided
    end

    % --- Simulate shocks ---
    eps = sigma * randn(T, 1);

    % --- Build GDP path ---
    G    = zeros(T+1, 1);
    G(1) = G0;
    for t = 1:T
        G(t+1) = G(t) * (1 + g + eps(t));
    end
end