So hello there everyone welcome to the third part of the
vehicle dynamics series.
In the last video we have seen that
how we can arrive at this velocity using
these simple calculations.
In this particular video we will see how
we can calculate this thing [velocities] in MATLAB
and we will see what are the advantages of using MATLAB
and
additionally we are also going to see how we can
use user-defined functions inside MATLAB
to ease our calculation.
So first basically we will see how we can
setup this calculation in MATLAB.
So if you are absolutely new to MATLAB then
I would suggest you to just
watch my another video on
“Getting Started with MATLAB”.
I will put the link in the description below.
You can also click on this Card here above.
You can click on that [for the video]
So this is the mass we have defined as 702 kg.
And
acceleration due to gravity is
9.81 m/s2
9.81 m/s2
The coefficient of drag is 0.8926,
and coefficient of lift is 2.4489.
And density of air is 1.2 kg/m3.
And coefficient of rolling resistance is  0.015,
mrr = 0.015,
 
and the radius of the wheel is 330 mm
that is [330 mm] = 0.33 metres.
Frontal area of the car is 1.47 m2.
All these values are defined
in the previous video only,
this is the problem statement given in the previous video
 
We started with a velocity of 251 kmph.
So our aim was to calculate what is the next velocity,
[and] what is the acceleration
and how much will be the speed after a time of
1 second
Right?
So...if we recollect back
at this particular speed [251 kmph] we have used a gear ratio of
g(6th) = 5.7443. But [however]
according to the speed we need to input the gear [ratio]. So
we cannot directly explicitly always specify it [gear ratio] all the time inside MATLAB
based on the speed. So...I have defined
a function called 'gearSelect'.
So based on the velocity 'u'
[and] based on this range of speed
we have defined the gear ratios. Right?
So...how should we
specify this data inside MATLAB that is the question.
So here, we defined a function called 'gearSelect'
this function takes in the velocity 'u'
if it is in the [1st] range it is
going to select the 1st gear ratio,
if it is in the [2nd] range
it is going to select the 2nd gear ratio.
So similarly I have written all the statements
using if-else statements. Right?
So finally
I have setup all these values according
to these gear ratios given in this table.
This particular statement here [highlighted]
will input the velocity
that is 251 kmph
and it converts it into m/s [metres per second]
and it activates the 'gearSelect' function.
So this 'gearSelect' function will select the particular gear ratio
and it will come back and assign the value to this 'Gn' [variable]
Ok? So this is the engine torque
that is 560 Nm and
we have the formula for FTraction
[Traction force]
So the Traction force is given as Te*Gn/R
FTraction = Te*Gn/R
So similarly
the Drag force is given as
FDrag = 1/2 * CD * Rho * Af * (u^2)
FDrag = 1/2 * CD * Rho * Af * (u^2)
Similarly Rolling Resistance [FRolling]
is given as
FRollResistance = mrr * (m*g + DownForce Term)
FRollResistance = mrr * (m*g + DownForce Term)
= mrr * (m*g + 1/2 * CL * Rho * Af * (u^2))
= mrr * (m*g + 1/2 * CL * Rho * Af * (u^2))
So now we are trying to calculate the Net Force. It is given as FNET = FTraction - FDrag - FRollResistance
This particular statement will give us the net force. The Net Acceleration is given as
acc = FNet / m
acc = FNet / m. So after getting the net acceleration
we are writing this statement v = u + acc * t
v = u+acc*t. [Now one thing] you can observe in all the above statements I have given semi-colon (;)
But if you want to display the particular
value of the statement in the command window you should ignore giving the semicolon (;).
Now if I try to run this code
it just gave
v = 77.78
[in metres per second]
There is a small typo in the slide
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
