Click here to Skip to main content
15,895,667 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Proof by mathematical induction Pin
Patrice T8-Feb-17 6:27
mvePatrice T8-Feb-17 6:27 
QuestionTrapezoid shaped movement (updated with the newest code and status) - SOLVED Pin
Joan M5-Feb-17 22:12
professionalJoan M5-Feb-17 22:12 
AnswerRe: Trapezoid interpolation Pin
Ralf Meier6-Feb-17 0:23
mveRalf Meier6-Feb-17 0:23 
GeneralRe: Trapezoid interpolation Pin
Joan M6-Feb-17 21:47
professionalJoan M6-Feb-17 21:47 
AnswerRe: Trapezoid interpolation Pin
Ralf Meier7-Feb-17 0:00
mveRalf Meier7-Feb-17 0:00 
GeneralRe: Trapezoid interpolation Pin
Joan M7-Feb-17 0:54
professionalJoan M7-Feb-17 0:54 
GeneralRe: Trapezoid interpolation Pin
Ralf Meier7-Feb-17 1:25
mveRalf Meier7-Feb-17 1:25 
GeneralRe: Trapezoid interpolation Pin
Joan M7-Feb-17 3:10
professionalJoan M7-Feb-17 3:10 
Hi again,

I've tried it and ported it into the code.

It looks promising as the newly calculated da + df are always the distance to run and moreover in the graphs I can see the numbers are what they should.

But I'm still having problems calculating the time and therefore the maximum speed:

VB
ta = Abs((vmax - v0) / a)
   da = (v0 * ta) + (0.5 * a * ta * ta)
   tf = Abs((vmax - vf) / a)
   df = (vf * tf) + (0.5 * a * tf * tf)
   
   If (da + df > dist + 0.000000001) Then
    If (v0 = vf) Then
      taux = (Sqr((a * dist) + (v0 * v0)) - v0) / a
      vmax = v0 + a * taux
    Else
      DistTotal = xf - x0 - da - df
      RelAccDec = da / (da + df)
      dist_corr_acc = DistTotal * RelAccDec
      da = da + dist_corr_acc
      dist_corr_dec = DistTotal * (1 - RelAccDec)
      df = df + dist_corr_dec

      taux = (Sqr((a * dist) + (v0 * v0)) - v0) / a  ' Here time is not getting calculated as it should... and therefore the vmax is also wrong...
      vmax = v0 + (a * taux)
    End If
   End If


For a data set of

vmax = 6000
v0 = 500
a = 2000
x0 = 200
xf = 1200

I should get a vmax of 1457 but I'm getting a vmax of 1500. as a first approximation this is ok, but I would like to get the right one from start.

Can you see something wrong with the approach?

Thank you very much Ralf.

PS: I'm sorry to annoy you.
GeneralRe: Trapezoid interpolation Pin
Ralf Meier7-Feb-17 6:57
mveRalf Meier7-Feb-17 6:57 
GeneralRe: Trapezoid interpolation Pin
Joan M7-Feb-17 10:13
professionalJoan M7-Feb-17 10:13 
GeneralRe: Trapezoid interpolation Pin
Ralf Meier7-Feb-17 20:21
mveRalf Meier7-Feb-17 20:21 
GeneralRe: Trapezoid interpolation Pin
Joan M7-Feb-17 20:45
professionalJoan M7-Feb-17 20:45 
GeneralRe: Trapezoid interpolation Pin
Ralf Meier7-Feb-17 21:34
mveRalf Meier7-Feb-17 21:34 
GeneralRe: Trapezoid interpolation Pin
Joan M7-Feb-17 21:46
professionalJoan M7-Feb-17 21:46 
AnswerRe: Trapezoid interpolation Pin
Ralf Meier8-Feb-17 0:33
mveRalf Meier8-Feb-17 0:33 
GeneralRe: Trapezoid interpolation Pin
Joan M8-Feb-17 1:07
professionalJoan M8-Feb-17 1:07 
GeneralRe: Trapezoid interpolation Pin
Ralf Meier8-Feb-17 2:01
mveRalf Meier8-Feb-17 2:01 
GeneralRe: Trapezoid interpolation Pin
Joan M8-Feb-17 8:59
professionalJoan M8-Feb-17 8:59 
GeneralRe: Trapezoid interpolation Pin
Ralf Meier8-Feb-17 10:05
mveRalf Meier8-Feb-17 10:05 
GeneralRe: Trapezoid interpolation Pin
Joan M9-Feb-17 4:26
professionalJoan M9-Feb-17 4:26 
GeneralRe: Trapezoid interpolation Pin
Ralf Meier9-Feb-17 5:32
mveRalf Meier9-Feb-17 5:32 
GeneralRe: Trapezoid interpolation Pin
Joan M9-Feb-17 8:59
professionalJoan M9-Feb-17 8:59 
GeneralRe: Trapezoid interpolation Pin
Ralf Meier9-Feb-17 9:35
mveRalf Meier9-Feb-17 9:35 
AnswerRe: Trapezoid interpolation Pin
Ralf Meier9-Feb-17 20:02
mveRalf Meier9-Feb-17 20:02 
GeneralRe: Trapezoid interpolation Pin
Joan M9-Feb-17 21:49
professionalJoan M9-Feb-17 21:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.