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 个评论

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.

请先登录,再进行评论。

 采纳的回答

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 个评论

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

请先登录,再进行评论。

更多回答(1 个)

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

类别

帮助中心File Exchange 中查找有关 Programming 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by