필터 지우기
필터 지우기

System of Second order order differential Equations referencing the 0th derivative

조회 수: 1 (최근 30일)
The following code refers to the system of differential equations in which only the first and second derivatives are included. How can the
zeroth derivative be referred to, for example, what if one of the equations was x'' = x*sqrt(x'^2+y'^2) rather than x'' = sqrt(x'^2+y'^2) - how could x be referred to? Writing
xy(0) for the 0th derivative or the position vector returns an error message but I am not sure how to modify the code. For example,
changing the first line to xy = zeros(6,1) does not help.
function xy=PackageMotion(t,x)
% the differential equation soltuion
xy=zeros(4,1);
% The paramter of the package
m=1; g=9.82; Cd=0.035;
% The differential equation described in state space form
%xy(1)
xy(1)=x(2); %first derivative (velocity)
xy(2)=(-Cd*x(2)*sqrt(x(2)^2+x(4)^2))/m;
xy(3)=x(4);
xy(4)=(-Cd*x(3)*sqrt(x(2)^2+x(4)^2))/m-g;
end
[SL: formatted the text of the question as text rather than code]
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 3월 17일
If you have the symbolic toolbox, then I suggest following the steps in the first example in odeFunction

댓글을 달려면 로그인하십시오.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 3월 17일
For the state space system inside the PackageMotion function, the variables are in this order
x(1) -> x-position
x(2) -> x-veclcity
x(3) -> y-position
x(4) -> y-velocity
So your 2nd equation should be
xy(2)=(-Cd*x(1)*sqrt(x(2)^2+x(4)^2))/m;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by