Hi,
On 08/mag/08, at 01:08, fraud profile wrote:
> Hi,
>
> I am using lsode to solve a simple ODE on Octave 2.1.72.
> The ode is:
> Solve: y''(t) + y(t) =0
> such that:
> y(0)=3 & y(pi/2)=3
LSODE is intended for solving intial value problems,
what you have is a boundary value problem.
if you install the BIM package from octave-forge you can solve your
equation by:
Nnodes = 100;
Nelements = Nnodes-1;
x = linspace(0, 1, Nnodes)';
y(Nnodes, 1) = y_pihalf = 3;
y(1, 1) = y_0 = 3;
A = BIM1Alaplacian(x, -ones(Nelements, 1));
A += BIM1Areaction(x, ones(Nelements, 1), -ones(Nnodes, 1));
y(2:end-1) = A(2:end-1,2:end-1) \ ( - A(2:end-1, [1 end]) * [y_0;
y_pihalf]);
plot(x,y)
c.
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave