1 view (last 30 days)

so i am given mass of an airplane, v1 and v2, F= -5*v^2 -570000 and the equation mv(dv/dx)= -5*v^2 - 570000

and i have to find how far the airplane travels before its speed is reduced to v2 using the trapezoid rule

So far i have

function Q = trapz( a,b,n )

x= linspace (a,b,n+1);

h = (b-a)/n;

Q = 0;

for i= 1:n

Q = Q + .5*(func(x(i))+func(x(i+1)))*h;

end

end

and i have

function value = Force(v)

value = -5*v^2-570000;

I don't know if i am on the right path or what to do from here. Please help and thank you

Asvin Kumar
on 1 Nov 2019

The original equation from your question is .

Rearranging the terms would give .

We would need to integrate the equation above as follows to obtain the distance travelled:

Try using the following code to obtain that. This is just a modified version of the code you had provided which uses the trapezoidal method:

trapz(93,40,1e3,0)

% a is initial point

% b is final point

% n-1 is the number of points in between a and b

% ic is the initial condition

function Q = trapz( a,b,n,ic )

x = linspace (a,b,n+1);

h = (b-a)/n;

Q = ic;

for i= 1:n

Q = Q + .5*(func(x(i))+func(x(i+1)))*h;

end

% % optimized code below

% tmp = func(x);

% Q = ic + h * ( sum(tmp)-0.5*(func(a)+func(b)) );

end

function val = func(v)

m = 97e3;

val = (m*v)./(-5*v.^2-57e4);

end

As darova had mentioned in their comment this can also be solved using ode45. Comparing with its documentation, the variable of differentation (t) in this case is 'v' while the variable being differentiated (y) is 'x'.

The code for that is:

[v,x] = ode45(@(t,y) 97e3*t/(-5*t.^2-57e4) ,[93 40],0);

plot(v,x)

Have a look at an example from the documentation solving a similar problem: https://www.mathworks.com/help/matlab/ref/ode45.html#bu3ugj4

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 3 Comments

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/487680-finding-the-distance-traveled-before-speed-is-reduced-to-a-certain-velocity#comment_760722

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/487680-finding-the-distance-traveled-before-speed-is-reduced-to-a-certain-velocity#comment_760722

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/487680-finding-the-distance-traveled-before-speed-is-reduced-to-a-certain-velocity#comment_760770

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/487680-finding-the-distance-traveled-before-speed-is-reduced-to-a-certain-velocity#comment_760770

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/487680-finding-the-distance-traveled-before-speed-is-reduced-to-a-certain-velocity#comment_760797

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/487680-finding-the-distance-traveled-before-speed-is-reduced-to-a-certain-velocity#comment_760797

Sign in to comment.