% script Global_Temperature. Analyze NASA data % relative to the surface overall temperature anomaly % in the period 1955 - 2000. % Anomaly is computed respect to the average of the % period 1951-1980. % Data can be downloaded from % https://climate.nasa.gov/vital-signs/global-temperature/ % clf t = (1955:5:2000)'; y = [-0.0480; -0.0180; -0.0360; -0.0120; -0.0040; 0.1180; 0.2100; 0.3320; 0.3340; 0.4560]; plot(t,y,'.','Markersize',12), ylabel('Temperature Anomly in Celsius') pause t_scal = (t-1950)/10; % time expressed in decades starting from 1950 % plotting grids tt = linspace(1955,2000,100); tt_scal = (tt-1950)/10; % % grado = length(t)-1; % interpolation degreepol = 3; % least squares with cubic polynomial cc = polyfit(t_scal,y,degreepol); hold on plot(tt,polyval(cc,tt_scal)) title('global surface temperatur anomaly') % alternative plot %p = @(x) polyval(cc,(x-1950)/10); % fplot(p,[1955 2000]) hold off