Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Differential equation and ode45 or ode15i
Replies: 10   Last Post: Jan 28, 2014 3:14 AM

 Messages: [ Previous | Next ]
 Torsten Posts: 1,717 Registered: 11/8/10
Re: Differential equation and ode45 or ode15i
Posted: Jan 27, 2014 9:41 AM

"shatrah " <shatrah1978@gmail.com> wrote in message <lc5q4c\$4a9\$1@newscl01ah.mathworks.com>...
> "Torsten" wrote in message <lc5mi0\$n5t\$1@newscl01ah.mathworks.com>...
> > "shatrah " <shatrah1978@gmail.com> wrote in message <lc35in\$d3g\$1@newscl01ah.mathworks.com>...
> > > dq/dz=dy/dz+q
> > > dy/dz=z*y
> > > ds/dz=dy/dz+dq/dz
> > >
> > > y=10, dy/dz=0 for z=0
> > > z=15, dz/dz=0 for z=0
> > > q=11, dq/dz=0 for z=0
> > >
> > >
> > > 1- how can solve this problem ? using ode45 or ode15i
> > >
> > >
> > > if i need to use ode45 can make like this
> > >
> > > dy(1)=dy(2)+y(1)
> > > dy(2)=y(2)*z
> > > dy(3)=dy(2)+dy(1)
> > >
> > >
> > > as a function filw ?
> > >
> > > Thanks

> >
> > function dy = test(z,y)
> > dy = zeros(3,1); % a column vector
> > dy(1)=z*y(2)+y(1);
> > dy(2)=z*y(2);
> > dy(3)=2*z*y(2)+y(1);
> >
> > But I don't understand your initial conditions:
> > y=10, dy/dz=0 for z=0
> > z=15, dz/dz=0 for z=0
> > q=11, dq/dz=0 for z=0
> >
> > Best wishes
> > Torsten.

>
> Dont look at my initial conditions , its just example ,
> my question can put like this dy(1)=dy(2) ??
>

Yes, you can. Just insert the expressions for the derivatives from the other equations.
dy(1)=dy(2)+y(1) can be written as dy(1)=z*y(2)+y(1) since dy(2)=z*y(2).
Likewise dy(3)=dy(2)+dy(1) can be written as dy(3)=2*z*y(2)+y(1) since
dy(2)=z*y(2) and dy(1)= z*y(2)+y(1).

Best wishes
Torsten.

Date Subject Author
1/26/14 shatrah
1/27/14 Torsten
1/27/14 shatrah
1/27/14 Torsten
1/27/14 shatrah
1/27/14 Torsten
1/27/14 shatrah
1/27/14 Steven Lord
1/27/14 shatrah
1/28/14 Torsten
1/28/14 shatrah