help-octave
[Top][All Lists]
Advanced

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

## Re: Octave not finding updated edited files

 From: Jim Maas Subject: Re: Octave not finding updated edited files Date: Wed, 18 Mar 2009 12:54:49 +0000 User-agent: Thunderbird 2.0.0.19 (X11/20090105)

```Thanks Ben,

```
That certainly is much simpler! I was just following a couple of examples I found that had a separate function file but this does look cleaner. No idea why t was in the inputs .... just copied blindly!
```
```
The example you send works well but the models I need to build will get much more complex, i.e. many state variables (pools) and therefore many (> 30 individual fluxes) fluxes. It would be nice to specify the individual flux equations somewhere separately from the individual derivative equations as I've done in this example. The problem is that now "y" is unspecified and gives the following error. Is there a way to specify the form of the equation outside the derivative equation statement?
```
octave:24> mmsinglefile
error: `y' undefined near line 20 column 26
error: evaluating binary operator `/' near line 20, column 27
error: evaluating binary operator `/' near line 20, column 24

Thanks a bunch

Jim

Ben Abbott wrote:
```
```
On Mar 18, 2009, at 5:52 PM, Jim Maas wrote:

```
--------------------------------------------------------------------------------------------------
```function dqadt = mmjam(t,y)
%-----------------------------------------------------------------------
% Specify the ODE (dynamic Michaelis-Menten expression)
% file mmjam.m called from mmjam0.m
% Dr. Jim Maas
% 18/03/09
%-----------------------------------------------------------------------
% Get rate constants from outside this function
global vmax km size qin
% Work in a more comprehensible set of variables
qa  = y;
% Subsidiary equations--------------------------------------------------
ca = qa / size;
qaout = vmax / ( 1 + ( km / ca));
% Dynamic equations--------------------------------------------------
%      dqadt(1) = qin - qaout; % dqa/dt
dqadt = qin - qaout; % dqa/dt
```
```
Jim, I don't see where the input "t" is being used.

It that an error, or intentional?

```
In any event, you should be able to skip creating of function file for mmjam entirely, by defining the function as ...
```
dqadt = @(t,y) [qin - vmax/(1+km/(y/sz))]

```
You can do that in mmjam0.m. This also allows you to delete the "global" variables. I've attached a modification of your example that works for me (I'm running Octave 3.0.3).
```
--

----
Jim Maas

```
```%-----------------------------------------------------------------------
% File mmjam0.m, main script file
% Demonstrate how to single pool model using  ODE
% Call ODE45
% Dr. Jim Maas
% 18/03/09
%-----------------------------------------------------------------------

% Read/assign model parameters -----------------------------------------
vmax = 36.79;
km   = 0.22;
sz = 115.0;
qin  = 18.63;

% Initial values -------------------------------------------------------
qa0=25.0;

% Auxillary Equations---------------------------------------------------

qaout =  vmax/(1+km/(y/sz));

% Call a routine to solve ODE ------------------------------------------
%   dqadt = @(t,y) [qin - vmax/(1+km/(y/sz))];
dqadt = @(t,y) [qin - qaout];

[t, y] = ode45 (dqadt, [0:0.1:10], qa0);            %Octave

% print/plot results ---------------------------------------------------
plot(t,y);
xlabel('TIME'); ylabel('QUANTITY');

```

reply via email to

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