finding the distance traveled before speed is reduced to a certain velocity
조회 수: 3 (최근 30일)
이전 댓글 표시
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
댓글 수: 3
darova
2019년 10월 28일
if F = -5v^2 - 570000 then m(dv/dt) = F
Looks like diff equation
You can use ode45 to solve it
채택된 답변
Asvin Kumar
2019년 11월 1일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!