Accelerate to speed within distance

Say I have 2 points 10 meters apart. I want an object to lerp between them. How would I make it to between meter 0 and 1 it accelerates from 0 m/s to speed 1 m/s, remains constant speed from 1 to 9, then between 9 and 10 it decelerates from 1 m/s to 0 m/s?

Or if they’re 50 meters apart, still accelerate between 0-1, remain constant 1-49, and decelerate 49-50?

I tried lerping on a sine curve, but it gave undesirable results. Anyone have a more elegant solution?

Okay, I figured out the math in case anyone else wants to know how to do this.’

if (distance <= distancetopoint1){
    speed = Mathf.sqrt(2*((maxspeed*maxspeed)/(2*distancetopoint1))*currentdistancetopoint1);
else if (distance <= distancetopoint2){
    speed = Mathf.sqrt(2*((maxspeed*maxspeed)/(2*distancetopoint2))*currentdistancetopoint2);
else {
    speed = maxspeed;

So basically I modified the g value from the physics freefalling object equation v = sqrt(2gd).

var acceleration : float;
var maxSpeed : float;

 function Update() {
 transform.Translate(0, acceleration * Time.deltaTime, 0);
 if (acceleration < maxSpeed) {
 acceleration += 1;

Implementing this in your script could help you add acceleration depending on dist.