[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problem with ode23
From: |
Juan Pablo Carbajal |
Subject: |
Re: problem with ode23 |
Date: |
Mon, 30 Jan 2017 00:50:36 +0100 |
On Sun, Jan 29, 2017 at 10:45 PM, Adrianna Andrusiewicz
<address@hidden> wrote:
> Can You write me how my code ought to be? I send one more time my wrong
> code:
> %make an m-file for all three, exer442.m
> function Yprime3= exer444(t,Y);
> Y(1)=x, Y(2)=y, Y(3)=z;
> Yprime3(3,1)=2*Y(3)-Y(3).*Y(3)-Y(2).*Y(3);
> end
> %all three
> [t,Y]=ode23(@exer444,[0 200],[2;5;1.5]);
> plot(t,Y(:,3),'g') %grass behavior
> hold on
> plot(t,Y(:,2),'b') %sheep behavior
> plot(t,Y(:,1),'r') %wolf behavior
>
> can You modify it, please?
>
> 2017-01-29 21:38 GMT+01:00 Juan Pablo Carbajal <address@hidden>:
>>
>> On Sun, Jan 29, 2017 at 1:02 PM, Adrianna Andrusiewicz
>> <address@hidden> wrote:
>> > Hi, I have problem with my code in Octave. I have to solve a
>> > differential
>> > equation.
>> > My code is:
>> > %make an m-file for all three, exer442.m
>> > function Yprime3= exer444(t,Y);
>> > x=2, y=5, z=1.5;
>> > Y(1)=x, Y(2)=y, Y(3)=z;
>> > Yprime3(3,1)=2*Y(3)-Y(3).*Y(3)-Y(2).*Y(3);
>> > end
>> > %all three
>> > [t,Y]=ode23(@exer444,[0 200],[2;5;1.5]);
>> > plot(t,Y(:,3),'g') %grass behavior
>> > hold on
>> > plot(t,Y(:,2),'b') %sheep behavior
>> > plot(t,Y(:,1),'r') %wolf behavior
>> >
>> >
>> > but I have an error:
>> > error: 'ode23' undefined near line 8 column 6.
>> > What is bad with my code?
>> >
>> >
>> > _______________________________________________
>> > Help-octave mailing list
>> > address@hidden
>> > https://lists.gnu.org/mailman/listinfo/help-octave
>> >
>> ode23 is not yet part of octave. You need to install a the odepkg
>> package for the moment
>> https://octave.sourceforge.io/odepkg/overview.html
>> in future version of octave ode* will be included by default.
>
>
Please keep the mailing list in CC, do not send private messages.
I do not know what' wring with your code, if anything is.
I just read the error message and it says ode23 is undefined. That
means that you do not have the function available.
If you have installed odepkg, the you need to load it doing
pkg load odepkg