help-octave
[Top][All Lists]
Advanced

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

unassigned variables


From: Jim Maas
Subject: unassigned variables
Date: Wed, 25 Mar 2009 13:03:21 +0000
User-agent: Thunderbird 2.0.0.21 (X11/20090318)

Hi All, thanks for help thus far. I might be asking too much, am trying iteratively to build up a model one step at a time, and usually when error messages start, they are not related to what I just added! :-D

I get the following error,

error: `qpa' undefined near line 28 column 29
error: evaluating argument list element number 2
error: evaluating binary operator `-' near line 28, column 46
error: called from `?unknown?'
error: evaluating assignment expression near line 328, column 17
error: evaluating if command near line 317, column 7
error: evaluating for command near line 314, column 5
error: evaluating while command near line 303, column 3
error: called from `ode45' in file `/usr/share/octave/packages/3.0/odepkg-0.6.4/ode45.m'
error: near line 45 of file `/home/jamaas/Resarch/Octave/M-M Stuff/jim.m'


when the last line

[t, qpb] = ode45 (dqpbdt, [0:0.1:10], qb0); %Octave

is added to the script.

Where have I gone wrong or is this perhaps a bug, using 3.0.4-rc5

Just for imformation, where do line numbers like 317 come from ?


Thanks

Jim
----
Jim Maas

%-----------------------------------------------------------------------
% File mmtwopool script file
% Demonstrate how code two pool model using ODE
% Corresponds to mmtwopool.odg diagram
% Call ODE45
% Dr. Jim Maas
% 25/03/09
%-----------------------------------------------------------------------


% Read/assign model parameters -----------------------------------------
    vab = 36.79;
    kab   = 0.22;
    sza = 115.0;
    fai  = 18.63;

    vbo = 39.76;
    kbo = 0.39;
    szb = 129.76;

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

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

    dqpadt = @(t,qpa)(fai - fab(t,qpa,vab,kab,sza));
    dqpbdt = @(t,qpb)(fab(t,qpa,vab,kab,sza) - fbo(t,qpb,vbo,kbo,szb));


    function [fab,cpa] = fab(t,qpa,vab,kab,sza)
      cpa = qpa / sza;
      fab = vab/(1+kab/cpa);
    endfunction

    function [fbo,cpb] = fbo(t,qpb,vbo,kbo,szb)
      cpb = qpb/szb;
      fbo = vbo/(1+kbo/cpb);
    endfunction

    
% Call a routine to solve ODE ------------------------------------------

   [t, qpa] = ode45 (dqpadt, [0:0.1:10], qa0);            %Octave
   [t, qpb] = ode45 (dqpbdt, [0:0.1:10], qb0);            %Octave

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


reply via email to

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