Click here to Skip to main content
15,891,431 members
Home / Discussions / Algorithms
   

Algorithms

 
QuestionProof by mathematical induction Pin
Member 129868787-Feb-17 0:18
Member 129868787-Feb-17 0:18 
AnswerRe: Proof by mathematical induction Pin
Pete O'Hanlon7-Feb-17 0:42
mvePete O'Hanlon7-Feb-17 0:42 
SuggestionRe: Proof by mathematical induction Pin
Richard MacCutchan7-Feb-17 1:46
mveRichard MacCutchan7-Feb-17 1:46 
AnswerRe: Proof by mathematical induction Pin
Chris Losinger7-Feb-17 8:46
professionalChris Losinger7-Feb-17 8:46 
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 
Hello Ralf,

Everything works.

I was simply trying to use a too high speed for a too short movement (totally obfuscated trying to get something impossible).

The only problem that I do still have is that I don't know how to efficiently find the maximum available speed.

What I'm doing is simple as:

VB
Do
 ta = Abs((vmax - v0) / a) ' Acceleration time.
 da = (v0 * ta) + (0.5 * a * ta * ta) ' Acceleration distance.
 tf = Abs((vmax - vf) / a) ' Deceleration time.
 df = (vf * tf) + (0.5 * a * tf * tf) ' Deceleration distance.
 If (da + df > dist) Then  ' if the accel and decel distances are bigger than the total distance...
   If (v0 = vf) Then  ' Only if v0 is equal than vf then we can calculate the time it will take to reach the middle position
     taux = (Sqr((a * dist) + (v0 * v0)) - v0) / a
     vmax = v0 + a * taux
   Else  ' Super slow way to search for the right speed (moreover it only decreases by 1 so it won't find exactly the right speed)
     vmax = vmax - 1  ' reduce the maximum allowed speed... it would be better to use a binary search than that,... but the best thing would be to use a mathematical calculation to find it...
   End If
 End If
Loop While (da + df > dist) ' We are doing this until the condition is met.


This works "perfectly":
- Avoiding the fact the maximum used speed will not be the purest maximum available.
- Avoiding the fact that it takes "ages" to find the maximum allowed speed for the current movement.

Any suggestion on how to find the maximum allowed speed in a faster way when v0 <> vf?

The initial data I do have is:

vmax (the one entered by the user it could be too high for what is possible).
x0 (initial position).
v0 (initial speed).
a (acceleration).
xf (end position).
vf (end speed (now we consider it always 0)).

Thank you.

modified 7-Feb-17 6:27am.

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 
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 

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.