필터 지우기
필터 지우기

use of ode45 for projectile trajectory including drag

조회 수: 3 (최근 30일)
ankur
ankur 2011년 9월 5일
equation of motion
dvx/dt = -k*v*vx
dvy/dt = -k*v*vy - g
where k = drag coefficient
v = sqrt((vx)^2 + (vy)^2)
after changing it into space variable it becomes
dvx/dx = -k*v,
dvy/dx = (-k*v*vy - g)/vx,
dt/dx = 1/vx,
dy/dx = vy/vx,
form these equation i have to find for fixed range :- time taken ,vx,vy,y-displacement at particular x-displacement using odesolver if i use ode45 it gives error because of only two variable in right side of each equation (vx and vy). how wil i solve this equation using ode45 or any other ode solver
please reply soon
thanks

채택된 답변

Grzegorz Knor
Grzegorz Knor 2011년 9월 5일
To solve this system, create a function ode_func containing the equations:
function dy = ode_func(x,y)
k = 1;
g = 9.8;
v = sqrt(y(1)^2+y(2)^2);
dy = zeros(4,1);
dy(1) = -k*v;
dy(2) = (-k*v*y(2)-g)/y(1);
dy(3) = 1/y(1);
dy(4) = y(2)/y(1);
And solve with ode45:
[X,Y] = ode45(@ode_func,...

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by