Find equation of cubic function with gradient?

I have to find a cubic function, when I know the gradient of that line at its start and finish.

The gradient at the start is 0.2, and at the top -0.4.

Using the cubic function: $f(x)=ax^3+bx^2+cx+d$ I need to model the section in between the red lines. Basically I assume I need to find $a,b,c,d$ and use the derivative of the cubic function with the gradients somehow (the gradients on the diagram are the gradients at the end of the red lines).

Thanks!

-
As an terminological aside: what you are trying to do here is to construct a cubic Hermite interpolant, since you have function and derivative values at two endpoints. – J. M. Apr 7 '11 at 5:15

You have four unknowns to determine ($a, b, c, d$), so you want to get four equations in these unknowns. Two equations come from the fact that you know the coordinates of the endpoints. Two equations come from the fact that you know the derivatives at the endpoints. Thus, you have four equations in four unknowns, and then you must solve for these unknowns. These equations are linear in the four unknowns, so you can solve for them in the usual way.