Struggling at 'Events' of ODE45
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
Walter Roberson
2015-11-30
options = odeset('RelTol', 1e2*AbsTol, 'AbsTol', AbsTol*ones(1,length(condIni)), ...
'Refine', 8, 'Events', @seccio);
3 个评论
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?
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!