필터 지우기
필터 지우기

Struggling at 'Events' of ODE45

조회 수: 1 (최근 30일)
Felix Lauwaert
Felix Lauwaert 2015년 11월 30일
댓글: Felix Lauwaert 2015년 12월 1일
Hello,
I have a ODE and need to compute the "exact" time and values of y at y(2)=0 and I'm using ode45 and 'Events'.
When I run my function, I get the error message: 'error using events. Not enough input variables.'
The part of my code:
options=['RelTol',1e2*AbsTol,'AbsTol',AbsTol*ones(1,length(condIni))...
,'Refine',8,'Events',seccio];
[T,Y,Te,Ye,Ie] = ode45(funRTBP,incT,condIni,options );
And my events function:
function [value,isterminal,direction] = seccio(t,y)
value = y(2);
direction = 0;
isterminal = 1;
end
AbsTol and condIni are correctly defined.
Thanks for your help.

채택된 답변

Walter Roberson
Walter Roberson 2015년 11월 30일
options = odeset('RelTol', 1e2*AbsTol, 'AbsTol', AbsTol*ones(1,length(condIni)), ...
'Refine', 8, 'Events', @seccio);
  댓글 수: 3
Walter Roberson
Walter Roberson 2015년 12월 1일
I think I will need to see more of your code.
Did you notice that I changed from [] around the options to odeset() around the options?
Felix Lauwaert
Felix Lauwaert 2015년 12월 1일
I hadn't seen it, now it works! Thank you vey much.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by