3
$\begingroup$

I think I'm making a mistake to reach my goal.

I would like to find an $x[t]$ function that could describe the following conditions:

1 - The object is in position $x=151$ (meters) at time $t=5$ (second).

2 - The object is in position $x=1215$ (meters) at time $t=59$ (second).

3 - The object has velocity $v=0$ (meters/second) at time $t=5$ (second).

4 - The object has velocity $v=0$ (meters/second) at time $t=59$ (second).

5 - The object has acceleration $a=1$ (meters/second^2) at time $t=5$ (second).

6 - The object has acceleration $a=0$ (meters/second^2) at time $t=59$ (second).

DSolve[{x[5] == 151, x[59] == 1215, x'[5] == 0, x'[59] == 0, 
  x''[5] == 1, x''[59] == 0}, x[t], t]

The goal

The idea is that the object be stopped at position $x=151$, be accelerated and decelerate at a certain point in the path (which may actually be random), so that when it reaches position $x=1215$, it stops.

enter image description here

$\endgroup$
  • $\begingroup$ This problem seems underspecified. I think that it has an infinite number of solutions. $\endgroup$ – bbgodfrey Dec 27 '17 at 14:23
  • $\begingroup$ But would it be possible to get one random solution? $\endgroup$ – LCarvalho Dec 27 '17 at 14:27
  • $\begingroup$ Try a sum of Chebyshev polynomials, defined over the domain {5, 59}. Choose coefficients such that the six boundary conditions are satisfied. $\endgroup$ – bbgodfrey Dec 27 '17 at 14:47
  • $\begingroup$ Your question concernes an interpolation problem. What means ' I want 1/3 of the path to be linear' ? $\endgroup$ – Ulrich Neumann Dec 27 '17 at 18:37
  • $\begingroup$ @Ulrich Neumann I removed the information about 1/3 linear in the path. Got confused. $\endgroup$ – LCarvalho Dec 28 '17 at 3:05
2
$\begingroup$

The trick is to pick a model. You have 6 equations so your model should have 6 degrees of freedom. One simple choice is a 5th order polynomial.

ClearAll[x,t,a,b,c,d,e,f]
x[t_]=a t^5+b t^4+c t^3+d t^2+e t+f

$f + e t + d t^2 + c t^3 + b t^4 + a t^5$

soln=Solve[{x[5]==151,x[59]==1215,x'[5]==0,x'[59]==0,x''[5]==1,x''[59]==0},{a,b,c,d,e,f}]

$\left\{\left\{a\to \frac{821}{76527504},b\to -\frac{124799}{76527504},c\to \frac{2668003}{38263752},d\to -\frac{12041369}{38263752},e\to -\frac{99539195}{76527504},f\to \frac{12063850529}{76527504}\right\}\right\}$

Show[{
    Plot[Piecewise[{{x[5],t<5},{x[t],t>=5}}]/.soln,{t,0,60},Ticks->{{5,59},{151,1215}}],
    Graphics[{Dashed,
        Line@{{0,151},{65,151}},
        Line@{{0,1215},{65,1215}},
        Line@{{5,0},{5,220}},
        Line@{{59,0},{59,1300}}
    }]
}]

enter image description here

Added by OP

soln = Solve[{x[5] == 151, x[59] == 1215, x'[5] == 0, x'[59] == 0, 
     x''[5] == 1, x''[59] == 0}, {a, b, c, d, e, f}] /. Rule -> Set;
x[t]

$\frac{821 t^5}{76527504}-\frac{124799 t^4}{76527504}+\frac{2668003 t^3}{38263752}-\frac{12041369 t^2}{38263752}-\frac{99539195 t}{76527504}+\frac{12063850529}{76527504}$

$\endgroup$
  • $\begingroup$ Added /. Rule -> Set, to show the result you wanted! $\endgroup$ – LCarvalho Dec 27 '17 at 23:34
  • $\begingroup$ I saw your profile. So many years without returning to the site ... you came back just because it's the end of the year ... $\endgroup$ – LCarvalho Dec 27 '17 at 23:39
  • $\begingroup$ @LCarvalho: I usually read this site on my work computer, and with their restrictions on internet posting I just don't post all that often. $\endgroup$ – user7739 Dec 28 '17 at 5:28
2
$\begingroup$

Your question can be easily solved with

y = Interpolation[{{{5}, 151, 0, 1} , {{59}, 1215, 0, 0}},Method -> "Hermite"]
Plot[y[t], {t, 5, 59}]

enter image description here

$\endgroup$
  • $\begingroup$ Is it possible to obtain the polynomial function of this result? $\endgroup$ – LCarvalho Dec 27 '17 at 23:23
  • $\begingroup$ @LCarvalho: Would be fine, but I don't know if its possible. You could do it by hand in the same way as user7739 proposed inhis answer. $\endgroup$ – Ulrich Neumann Dec 28 '17 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.