help-octave
[Top][All Lists]
Advanced

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

strange behavior from gnuplot


From: Mikel Maron
Subject: strange behavior from gnuplot
Date: Wed, 26 Nov 2003 10:16:29 -0800 (PST)

Hello!

I have just begun using octave (on cygwin), having worked with matlab
at my university.

As a first try, I ran my small matlab file, which plots a set of
differential equations (the Lokta-Volterra predator-prey model).

After plotting several dozen points, with "hold on", gnuplot slows down
significantly, and after several hundred points, freezes completely. My
fuzzy diagnosis: gnuplot can only hold so many plots, even if there are
simply a single point.

Perhaps there is something naive in my code/plot. Perhaps something
else. Suggestions and help much appreciated. Code is pasted in below.

Mikel

call like "predatorPrey(0.05, 60, 100, 5)"

==========================================

function predatorPrey(h, length, OldX, OldY)
    NumTimeSteps = length / h;
    PauseFlag = true;
   
    hold on;
    for s = 1:NumTimeSteps
        [x,y] = growth(OldX, OldY, h);
        
        plot([s*h],[x],'bx;;');
        plot([s*h],[y],'rx;;'); 
        
        if (PauseFlag || s == 100)
            r=input('press enter to continue, 0 and enter to stop
pausing\n');
           if (r==0) PauseFlag = false; end
       end;
        
        OldX = x;
        OldY = y;
    end;
    hold off;
    
function [x,y] = growth(OldX, OldY, h)
    r = 0.6; a = 0.05; f = 0.1; q = 0.4;
    x = OldX + h *(r * OldX - a * OldX * OldY);
    y = OldY + h *(f * a * OldX * OldY - q * OldY);


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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