How to modify settings for event detection in MATLAB?

Asked by Sarah Ghosh on 28 Jun 2013 at 4:16
Latest activity Commented on by Sarah Ghosh about 13 hours ago

I am writing a code for event detection. However, I want to increase the region of convergence from zero to about 1e-4.For example, instead of checking for y(1)-10=0, I want to check for y(1)-10<1e-4. How can this be done?

2 Comments

Walter Roberson on 28 Jun 2013 at 4:29

Are you referring to event detection in the context of one of the ode*() routines?

Sarah Ghosh on 28 Jun 2013 at 15:49

Yes, it comes with the options parameter of ode*

Sarah Ghosh

Products

No products are associated with this question.

1 Answer

Answer by Walter Roberson on 28 Jun 2013 at 18:41
Accepted answer

Return

 y(1)-10 >= 1e-4

This will be false (0) when it is within 1e-4. Set the options so the crossing direction does not matter.

3 Comments

Sarah Ghosh about 20 hours ago

Undefined function or method 'sign' for input arguments of type 'logical'. Error in ==> odezero at 47.

It looks like it does not accept a logical value

Walter Roberson about 14 hours ago

Return

double(y(1)-10 >= 1e-4)
Sarah Ghosh about 13 hours ago

Yes, it worked.... thanks a lot for the help....

Walter Roberson

Contact us