%% Week 1 Challenge (Nominal GDP from World Bank)
clear; close all; clc;
% Assumes you've wb_nominal_gdp.mat in your current folder
load('wb_nominal_gdp.mat', 'WB_years', 'WB_gdp', 'country');

% Compute growth rates (%)
g = 100 * (WB_gdp(2:end)./WB_gdp(1:end-1) - 1);

% Average GDP
gdp_avg = mean(WB_gdp);

% Plot levels
figure;
plot(WB_years, WB_gdp/1e9, '-o', 'LineWidth', 1.25); grid on;
xlabel('Year'); ylabel('GDP (current US$, billions)');
title(['Nominal GDP — ' country]);
hold on; yline(gdp_avg/1e9, '--', 'Mean GDP'); hold off;

% Save outputs
save('myWorkspace.mat');
saveas(gcf, 'gdp_plot.png');

