odeevent
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi there,
I have an odeevent sub-routine:
function [x,isterm,dir] = odeevent(~,y,k1,k2,k3,mu,d1,d2,r,K,k,alpha,gamma,n)
dy = funl2([],y,k1,k2,k3,mu,d1,d2,r,K,k,alpha,gamma,n);
x = norm(dy) - 1e-3;
isterm = 1;
dir = 0;
this works well. But in addition to this norm condition, i want to apply another condition too, viz
y(2)+y(3)<10
isterm=1;
I want the program to work like:
If the norm condition is satisfied then the code should stop. Otherwise if the second condition is satisfied then the program should stop. I don't know how to put it into MATLAB language. Can someone help me out! Thanks a lot in advance!!
0 Kommentare
Antworten (1)
Walter Roberson
am 20 Apr. 2011
I am not clear what your norm condition is. Is it norm(dy) < 1E-3 ?
If so, then
dy = funl2([],y,k1,k2,k3,mu,d1,d2,r,K,k,alpha,gamma,n);
x = norm(dy) - 1e-3;
isterm = x >= 0 || y(2) + y(3) < 10;
dir = 0;
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!