[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bvp4c script
From: |
Diana |
Subject: |
bvp4c script |
Date: |
Thu, 13 Jun 2013 09:19:32 -0700 (PDT) |
Hi another newbie question,
For an online course I am trying to implement bvp4c to compute a nonlinear
ODE. The example shown during the video lectures is in Matlab. bvpint is
defined with a parameter value. I have already read through the Octave
function reference page. Yet I can't seem to translate the bvpint
computation to the script found
http://octave.sourceforge.net/odepkg/function/bvp4c.html
I was able to run bvp4c w/o specifying a parameter using the format
referenced above. I also noticed the computation is very slow. However since
I am doing this for an online, self-study course, I don't mind that
drawback. This is what I have so far:
function rhs=rhs_bvp1(x,y,beta)
rhs=[y(2);(beta-100)*y(1)-y(1)^3];
function bc=bc_bvp1(yl,yr,beta)
bc=[yl(1);yl(2)-1;yr(1)]
t=linspace(-1,1,50);
h=diff(t);
u_0=[cos((pi/2)*t);-(pi/2)*sin((pi/2)*t)];
beta=99;
solinit.x=t; solinit.y=u_0;
sol=bvp4c(@rhs_bvp1,@bc_bvp1,solinit);
plot(sol.x,sol.y,'x-');
Thanks for any help. Again this is my first time using anything like Octave
(I've never used Matlab).
Diana
--
View this message in context:
http://octave.1599824.n4.nabble.com/bvp4c-script-tp4654170.html
Sent from the Octave - General mailing list archive at Nabble.com.
[Prev in Thread] |
Current Thread |
[Next in Thread] |