%% Week 1 Challenge (Nominal GDP from World Bank) — Starter Code
clear; close all; clc;

% Assumes you've wb_nominal_gdp.mat in your current folder
% This file should contain: WB_years, WB_gdp, country
load('wb_nominal_gdp.mat', 'WB_years', 'WB_gdp', 'country');

%% -------------------- Task 1: Compute growth rates --------------------
% TODO: compute growth rates (%) from WB_gdp
% Hint: 100*(x_t/x_{t-1} - 1)
g = [];   % <-- replace with your code

%% -------------------- Task 2: Average GDP --------------------
% TODO: compute the average GDP (levels)
gdp_avg = NaN;   % <-- replace with your code

%% -------------------- Task 3: Plot GDP levels --------------------
% TODO: plot GDP levels over time (in billions)
% Hint: divide WB_gdp by 1e9
figure;
% plot(...); grid on;
% xlabel('Year'); ylabel('GDP (current US$, billions)');
% title(['Nominal GDP — ' country]);
% hold on; yline(..., '--', 'Mean GDP'); hold off;

%% -------------------- Task 4: Save outputs --------------------
% TODO: save the workspace and export the figure as PNG
% Hint: use save('myWorkspace.mat') and saveas(gcf, 'filename.png');

%% -------------------- (Optional) Task 5: Plot GDP growth --------------------
% TODO: plot GDP growth rates over time
figure;
% plot(...); grid on;
% xlabel('Year'); ylabel('Growth rate (%)');
% title(['Nominal GDP growth — ' country]);
% saveas(gcf, 'gdp_growth_plot.png');