Matlab ode453/31/2024 ![]() If you do want your perturbation occur when particular conditions are met (rather than at a particular time) then you'll need to use an event function (see this question, for example). You would have effectively produced a very stiff system. Second, inserting large discontinuities in your ODE can lead to less precision and longer computation times (especially with ode45 - ode15s might be a better option or at least make sure that your absolute and relative tolerances are suitable). First, if you want it to occur exactly at a particular time or when particular conditions are met, this can't be done from within the ODE function. What you don't want to try to do (but many attempt) is add your perturbation inside the integration function. The Matlab editor may complain about the array T and Y not being preallocated and/or growing, but it's fine in this case as they're growing in large chunks only a few times. = % Remove first value as it will be same as last of previous run ![]() The way to do this is to integrate the system piecewise and append the resultant outputs from each run together: % t = 0 to t = 6 ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |