Effacer les filtres
Effacer les filtres

[PLEASE HELP] Derive the time and distance values...

3 vues (au cours des 30 derniers jours)
james bond
james bond le 5 Déc 2017
Modifié(e) : Jim Riggs le 12 Déc 2017
a car accelerates from rest , t=0
I derived the following equations, but need help the translate into matlab
a(v)=dv/dt
dt=(1/a(v))dv
see attached for the 3rd equation
see attached for the table i constructed for the required data
  1 commentaire
Jan
Jan le 7 Déc 2017
The question is not clear. You want to translate this into Matlab, but what is the actual problem you want to solve? In which format are which inputs available and what is the wanted output?

Connectez-vous pour commenter.

Réponses (1)

Jim Riggs
Jim Riggs le 7 Déc 2017
Modifié(e) : Jim Riggs le 7 Déc 2017
After looking at your table, it is clear that you are given a time history of velocity and acceleration samples and you wish to find the time and position which correspond with the v and a samples. The answer is quite simple using numerical methods:
The velocity/acceleration are related by
vi+1 = vi + (ai+1 + ai)/2 * dt
(where ai and vi are the current sample value of a and v, and ai+1 and vi+1 are the next sample values. dt is the time interval between samples i and i+1. Also, note that (ai + ai+1 )/2 represents the average acceleration for sample period from i to i+1.
therefore, the time corresponding to the interval from i to i+1 is:
dt = (vi+1 - vi) *2 / (ai+1 + ai)
sum the sequence of dt's for all intervals to get total time.
Likewise, the change in distance over interval i to i+1 is: deltaD = (vi + vi+1)/2 * dt (again, using the average velocity from i to i+1)
Sum the sequence of deltaD's for all intervals to get total distance.
  4 commentaires
james bond
james bond le 9 Déc 2017
wow, i always thought that there were some form of differentiating involved...so, there is no differentiation or integration involved ?
Jim Riggs
Jim Riggs le 12 Déc 2017
Modifié(e) : Jim Riggs le 12 Déc 2017
Of course there is. As I said, this is a numerical methods implementation. Quite easy for this type of problem, as you can see by the equations. Refer back to my discussion, above.
This set of calculations I gave you is using your equations from your image.png file. The second equation defines the time interval, dt.
dt = 1/a(v) * dv
The acceleration term (1/a(v)) is expressed as (2/(a(i+1+a(i)). The discrete sample (i index) is along v from your data table, i.e. i=1 is the first row in your table, i=2 is the second row, etc. up to 15 samples. This is implicitly a function of v (a(v)) because it is an association of a with v. It appears as 2/(a(i+1+a(i)) in my implementation (rather than simply 1/v(i)) because I am using the average if the i and i+1 samples for the interval i to i+1. Now, the dv term is simply the change in v, which is expressed as (v(i+1) - v(i)) This is the change in v over the interval i to i+1. Put these two terms together and you have your differential equation dt = 1/a(v) * dv expressed in discrete numerical form: dt = (2/(a(i) + a(i+1)) * (v(i+1 - v(i)).
This is simply a discrete implementation of your differential equation. It can be calculated for i=1 to 15 to obtain the time step between each v sample in your table. Sum up all of the dt values and you have the total time (this summing operation is numerical integration). This is identical to your third equation, which is the integral of dt with velocity.
So, let's work through a numerical example:
The time interval from row 1 to row 2 in your table is dt. Let i = 1, so v(i) = 0 and v(i+1) = 3, a(i) = 1.2 and a(i+1) = 1.2. The 1/(a(v) term is 2/(1.2 + 1.2) which is equal to 1/1.2. The dv term is (3-0) which is equal to 3. so dt = 3/1.2 = 2.5 seconds. Let's make a dt column and put this value in row 2 of the dt column.
Next move to the next interval, i=2. v(i) = 3 and v(i+1) = 5.9 , a(i) = 1.2 and a(i+1) = 1.2. 1/a(v) = 2/(1.2+1.2) = 1/1.2. dv = (5.9 - 3) = 2.9. So dt = 2.9/1.2 = 2.41666. Put this in row 3 under dt. In the time column now we have row 1 = 0, row 2 = 2.5 and row 3 = 4.91666. Continue on for the remaining rows and you have the time for each interval (dt) and the total time.
Now that you know the time, you can compute the distance, which is the integral of v over time.
See the attached .pdf file which I computed using the equations from my previous post (in an Excel spreadsheet)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Parallel Computing dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by