help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave program to solve ODE


From: address@hidden
Subject: Re: Octave program to solve ODE
Date: Mon, 27 Jul 2015 20:01:06 +0900 (JST)

--- deepuskmr
> I have an ODE
> 
> dy=x dx,  y(0)=2
> The solution of this equation is y =x^2/2 + K.
> 
> K become 2.
> Now I have to plot graph. When
> 
>  x=0, y=2
>  x=1, y=2.5
>  x=2, y=4
>  x=3, y=6.5
>  x=4, y=10
> I have to write an Octave program to generate these values
> 
> My code is test.m
> 
> function xdot = f (x,t)
>  xdot=x;
>  endfunction
>  x=lsode("f",2,(t=linspace(0,4,5)));
>  #plot(t,x)
>  x
> I run the pgm in cmd but it gives
> 
> 2.0000
> 5.4366
> 14.7781
> 40.1711
> 109.1963
> The expected result is
> 
> 2
> 2.5
> 4
> 6.5
> 10
> Please help me..
> 

In function, 
 xdot=t;

Tatsuro



reply via email to

[Prev in Thread] Current Thread [Next in Thread]