Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to Solve coupled ODEs
Date: Thu, 7 Feb 2013 08:15:23 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 31
Message-ID: <kevnqr\$lgb\$1@newscl01ah.mathworks.com>
References: <keujnd\$h64\$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: www-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1360224923 22027 172.30.248.37 (7 Feb 2013 08:15:23 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 7 Feb 2013 08:15:23 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:788473

"Henry" wrote in message <keujnd\$h64\$1@newscl01ah.mathworks.com>...
> Hi there,
>
> I'm having a hard time solving a set of 2 coupled ODEs:
>
> dx/ds = 1/x * [y* (d + y/s) - a*x*f]
> dy/ds = 1/x * [-y * (b + y) * f] - y/s - c
>
> where f = sqrt(x^2 + y^2*(e + y)), and all constants are vectors of (100 x 1). The independent variable is "s".
>
> %----------------------------------------------------------------------
> global a b c d e
> y = ode45(@odeeqns, s, [1 1])
>
> function dyds = odeeqns(s,y)
>    global a b c d e
>    dyds(:,1) = 1./y(1) .*(y(2) .* (d + s ./ y(2)) - a .* y(1) .* sqrt(y(1).^2 + (e +  y(2)).^2));
>    dyds(:,2) = - (y(2) .* (b + y(2)) .* sqrt(y(1).^2 + (e + y(2)).^2))./y(1) - y(2)./s - c;
> return
> %----------------------------------------------------------------------
>