Path: news.mathworks.com!not-for-mail
From: "Roland " <burgmann@gmx.de>
Newsgroups: comp.soft-sys.matlab
Subject: Re: ode, tan, singularity?
Date: Sat, 10 Mar 2012 09:49:12 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <jjf82o$g3m$1@newscl01ah.mathworks.com>
References: <jjbbul$r7c$1@newscl01ah.mathworks.com> <jjbupc$m25$1@newscl01ah.mathworks.com> <jjch18$ens$1@newscl01ah.mathworks.com> <jjdopn$ptc$1@newscl01ah.mathworks.com>
Reply-To: "Roland " <burgmann@gmx.de>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1331372952 16502 172.30.248.45 (10 Mar 2012 09:49:12 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 10 Mar 2012 09:49:12 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1293762
Xref: news.mathworks.com comp.soft-sys.matlab:760535

"Roger Stafford" wrote in message <jjdopn$ptc$1@newscl01ah.mathworks.com>...
> "Roland " <burgmann@gmx.de> wrote in message <jjch18$ens$1@newscl01ah.mathworks.com>...
> > .........
> > I am not shure if i understood correctly your suggestion. should i split up the function, one part for 
> > beta < pi /2 
> > and one for 
> > beta > pi/2?
> - - - - - - - -
>   When (b2-b1)/(z2-z1) < 0, as is the case with your equations, the trajectory followed by a solution to those differential equations assumes an infinite dz/du slope at beta = pi/2 and u cannot continue to increase.  The natural path for the trajectory to follow from there on would be along a vertical mirror image of the path with u now decreasing and z continuing to decrease as it finally asymptotically approaches the beta = pi level with u approaching minus infinity.  However with ode45 committed to advancing u, this is not possible, so my recommendation is to set ode45 to stop right at beta = pi/2.  As you have it set up, ode45 cannot continue from there without "hanging up" and producing nonsense.
> 
>   A similar situation holds for the entire family of trajectories with all the various possible initial conditions.  Whenever beta is equal to pi/2 or differs from that by a multiple of pi - that is, whenever tan(beta) is infinite - the trajectories will necessarily reverse the direction of u as they cross the corresponding horizontal line.  If (b2-b1)/(z2-z1) > 0 these trajectories are reversed in the u direction with asymptotes occurring as u approaches plus infinity.
>   
> Roger Stafford

------------------------------------

Roger, thanks for the explanation of whats going wrong in my code. I solved the problem by solving for du/dz instead of dz/du, which makes everything much easier.

Roland