[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How do script commands differ from term commands?
From: |
Peder Møller |
Subject: |
Re: How do script commands differ from term commands? |
Date: |
Wed, 6 Apr 2005 06:40:02 -0500 |
Hmm...
I figure it is not a command problem, but rather an installation
problem since a simple file with the commands below does not work
either.
function y = f (x)
y = cos(x/2)+x;
end
Any ideas what the problem might be? The error message is:
error: `x' undefined near line 2 column 9
error: evaluating binary operator `/' near line 2, column 10
error: evaluating argument list element number 1
error: evaluating binary operator `+' near line 2, column 13
error: evaluating assignment expression near line 2, column 3
error: called from `f' in file `/octave_files/f.m'
Sorry for spamming in this way...
- Peder
On Apr 6, 2005 12:52 PM, Peder Møller <address@hidden> wrote:
> Hi,
>
> How do script commands differ from term commands?
>
> The lines below work fine if typed into the command term of Octave,
> however, they do NOT work if typed as they are into a .m file. What
> should I change?
>
> - Peder
>
> function xdot = f (x, t)
>
> r = 0.25;
> k = 1.4;
> a = 1.5;
> b = 0.16;
> c = 0.9;
> d = 0.8;
>
> xdot(1) = r*x(1)*(1 - x(1)/k) - a*x(1)*x(2)/(1 + b*x(1));
> xdot(2) = c*a*x(1)*x(2)/(1 + b*x(1)) - d*x(2);
>
> endfunction
>
> x0 = [1; 2];
>
> t = linspace (0, 50, 200)';
>
> x = lsode ("f", x0, t);
>
> plot (t, x)
>
>
> --
> Something unknown is doing we don't know what;
>
> Sir Arthur Eddington (1882 - 1944)
>
--
Something unknown is doing we don't know what;
Sir Arthur Eddington (1882 - 1944)
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- Re: How do script commands differ from term commands?,
Peder Møller <=