I am trying to find the maximum velocity in a trapezoidal-like motion profile given the initial velocity, the final velocity, the acceleration, the total time and distance traveled.
If the initial and final velocities were zero, I would simply use this formula:
$$ v=-\frac{a\left(-t\pm\sqrt{\frac{at^2-4d}{a}}\right)}{2} $$
where $a$ = acceleration, $t$ = time and $d$ = distance
I have tried to draw the trapezoidal-like shape and add all the different parts of the geometric figure like this:
$$d = d_{a} + d_{vmax} + d_{d}$$
Distance traveled during acceleration: $$d_{a} = v_0t_a + \frac{1}{2}at_a^2$$
Distance traveled during deceleration: $$d_{d} = v_1t_d + \frac{1}{2}at_d^2$$
Distance traveled with maximum velocity: $$d_{vmax} = v(t - t_a - t_d)$$
Then I substitute $t_a$ and $t_d$ using $t\:=\:\frac{v-v_0}{a}$, resulting in the following equation:
$$d\:=\:v\left(\frac{x-v}{a}\right)+\frac{1}{2}a\left(\frac{x-v}{a}\right)^2\:+x\left(t-\left(\frac{x-v}{a}\right)-\left(\frac{x-w}{a}\right)\right)\:+\:w\left(\frac{x-w}{a}\right)+\frac{1}{2}a\left(\frac{x-w}{a}\right)^2$$
where $x$ = the unknown maximum velocity, $v$ = initial velocity, $w$ = final velocity.
Obviously this does not work as intended. The results I get don't make much sense.
I would really appreciate some help on this matter.