how to write a matlab code for this physics problem?

An airplane uses a parachute and other means of braking as it slows down on the runway after landing. Its acceleration is given by a=-0.0035 3v^2-3 m/s^2 . Since , a=dv/dt the rate of change of the velocity is given by: dv/dt=-0.0035v^2-3
Consider an airplane with a velocity of 300 km/h that opens its parachute and starts decelerating at t = 0 s. a. By solving the differential equation, determine and plot the velocity as a function of time from t = 0 s until the airplane stops.
Use numerical integration to determine the distance x the airplane travels as a function of time. Make a plot of x versus time.

2 Comments

Looks a lot like a homework question, show us what you have tried so far.
syms t
ode='Dv=-0.0035v^-3';
init='v(0)=300';
v=dsolve(ode,init,'t');
y=eval(vectorize(y));
plot(t,y)
For the first part I do not know how to put an interval for t that airplane stops.

Sign in to comment.

 Accepted Answer

Always remember eval is evil: Reason to avoid eval
t=[0 100] %arbitrary time range since we don't know when it reaches ground
x0=300;
opts = odeset('Events',@stopfunc) %it will stop integration when distance becomes zero
[t,x]=ode45(@myod,t,x0,opts)
plot(t,x)
time_when_distance_becomes_zero=t(x==0)
function dvdt = myod(t,x)
dvdt=-0.0035.*x(1).^2-3;
end
function [position,isterminal,direction] = stopfunc(t,x)
position = x(1); % The value that we want to be zero
isterminal = 1; % Halt integration
direction = 0; % The zero can be approached from either direction
end

2 Comments

Thank you so much, it really helped !
Anytime :) , if my answer helped make sure to accept the answer

Sign in to comment.

More Answers (1)

Resolve the horizontal 600lb force in fig a into components acting along the u and vaxes and determine of these components

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!