# Constrained Interpolation in Matlab

I am trying to develop several cumulative carbon emissions to later upload to a climate model. The goal is to design curves whose yearly emissions will sum to a specific cumulative emissions (eg 1 Gigaton C, 2 Gigaton C, etc), and mesh with the historical cumulative emissions (347 GtC).

For example,

In the case of the 1 GtC curve, I am looking to employ MatLab's interpolation capabilities to create a function whose annual cumulative emissions will sum to (1000-347 = 653 GtC) by a specific year (lets say 2100). I am planning to include several intermediate values (one at the start of the curve, one for the maximum annual emissions, and the end point (the year that annual emissions fall to zero).

Is there any way to do such a thing?

I have figured out how to create an emissions curve without worrying about the specific cumulative emissions and have included the MatLab code here:

F=Historical;
Y=F(:,1);
M=F(:,2);
G=F(:,3);
%plot Historical data
%plot(Y,G)
%title('Global Estimated Annual CO_2 Emissions')
%xlabel('Year')
%ylabel('Global Estimated Annual CO_2 Emissions (GtC)')

%spline interpolator using ten intermediate values
x = 2008:10:2098;
y = [8.75 10.5 12.0 11.25 9.75 7.5 4.5 2.25 0.75 0]
cs = spline(x,[0 y 0]);
xx = linspace(2008,2098,101);
plot(x,y,'o',xx,ppval(cs,xx),'-')%

%cumulative emissions for future portion of curve
S=spline(x,y,2009:2098);
Y2=2009:1:2098;

%plot curve with both historical and future emissions
plot(Y,G,Y2,S)
title('Global Estimated Annual CO_2 Emissions')
xlabel('Year')
ylabel('Global Estimated Annual CO_2 Emissions (GtC)')
legend('Historical(1751-2008)','Future(2009-2098)')

%Total Cumulative Emissions (1751-2098)
T1=cumsum(G)
T2=cumsum(S);
T3= T1(257) + T2(90)

The idea is to modify this, such that I can force the interpolator to create a function where T3 will equal 1000 (i.e the integral of the curve equals 1000 Gt)?