MATLAB: Identify time and position when reach terminal velocity

numerical integrationode'sode45terminal velocity

hi, i have this code:
F = 4000.0; % force
m = 1300.0; % mass
A = 3.0; % frontal area, [m^2]
Cd = 0.6; % drag coefficient, [-]
rho = 1.23; %air density
v0 = 5; %velocity at t = x = 0
vTerm = sqrt(2*F/(Cd*rho*A)); %terminal velocity
dxdt = @(t,x)(sqrt((2.*F)./(Cd.*rho.*A))); % V(t) = diff( X(t) ,t )
tspan =[0 100]; %
x0 = 0;
opts = odeset('RelTol',1e-8,'AbsTol',1e-8);
[t,x] = ode45(dxdt, tspan, x0,opts);
first i need to set the relative tolerance to 1e-8 by using odeset before using ode45 to solve for x and t, which i'm unfamiliar with so can i get some comment on what i did whether its right or not ??, if not, any suggestion would be appreciated, thanks.
secondly, i now need to find t and x at which the velocity reach 99% of vTerm and i got no where trying to solve it. i think one of the problem could be that my function was wrong since i dont think its return the v0=5 as in the question, but i cant seem to find another function for it. Can i please have some help, thank you

Best Answer

  • The odeset looks fine for setting the tolerances.
    Your code should not be using any formula for terminal velocity given forces, and it should certainly not be integrating that formula. (Notice the formula does not even involve t or x.)
    Instead, your code should be using an expression for dV -- given the current time and boundary conditions, how would you calculate the change in velocity ? Downward force due to gravity minus upward force due to friction based upon the current velocity. Now run that ode getting out time and velocity. The terminal velocity is the last output velocity from the ode. Now locate the position inside the velocity vector where the velocity vector first reaches at least 99% of that final velocity, and use that location to index the time vector.
    Since you are asked to get out velocity and position, the implication is that you need to be using an ode with two parameters, with formulas for dP and dV and getting out P and V.