문제

I have a nonlinear-ODE of the second order with trigonometric functions such that I cannot formulate it depending of the second derivation. For example:

ay'' + b arctan(y'') + cy' + dy=0
y'(0)=0, y''(0)=0

Without existence of a term like arctan(y'') I could write my ode function like

function output=myodefunc(u,t){
  y(1)=u(2);
  y(2)=(-c*u(2)-d*u(1))/m;
  output=y';
}

Unfortunately the nonlinear term of the second order (=> b*arctan(y'') ) makes me unable to write the ode in dependence of y'' .

Is there any way to solve such a trigonometric ode numerically in Matlab?

도움이 되었습니까?

해결책

One can evaluate the y'' with a nonlinear solver (fsolve), within the ode function:

function output=myodefunc(u,t){
  y(1)=u(2);
  x0=0;
  x=fsolve('a*x + b*atan(x) + c*u(2) + d*u(1)',x0);
  y(2)=x;
  output=y';
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top