[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: phase portrait
From: |
Peter Gawthrop |
Subject: |
Re: phase portrait |
Date: |
Mon, 21 Feb 2005 14:53:23 +0000 (GMT) |
Hi Arnau,
try adapting this script. I guess th is x and dth is y in your
notation. You also need to write fun.m to give dx in terms of x=[th;dth] -
equivalent to your f&g functions rolled into one.
Peter.
dt = 0.1;
TH = [-1:0.1:1];
DTH = 5*[-1:0.1:1];
N = length(TH);
M = length(DTH);
i=0;
THETA = zeros(N*M,1);
DTHETA = zeros(N*M,1);
D_THETA = zeros(N*M,1);
D_DTHETA = zeros(N*M,1);
for th=TH
for dth=DTH
i++;
x = [th;dth];
dx = fun(x);
D_DTHETA(i) = dx(1);
D_THETA(i) = dx(2);
THETA(i) = th;
DTHETA(i) = dth;
endfor
endfor
M = [THETA DTHETA D_THETA*dt D_DTHETA*dt];
gset nokey
axis([min(TH), max(TH), min(DTH), max(DTH)]);
ylabel("$\\dot{\\theta}$")
xlabel("$\\theta$")
grid on;
gplot M with vector
From: Arnau Mir Torres <address@hidden>
Subject: phase portrait
Date: Mon, 21 Feb 2005 15:36:45 +0100
> Hello.
> I want to plot a phase portrait for a system of differential equations
> of the form:
>
> xdot= f(t,x,y)
> ydot= g(t,x,y)
>
> where t is the independent variable.
>
> I want to plot in the x-y plane coordinates the phase portrait of the
> previous differential equation.
>
> Somebody can tells me if there exists a package or a script in octave
> that does it?
>
> Thanks in advance,
> Arnau.
>
>
> --
> Arnau Mir Torres
> Director Departament Matemà tiques i Informà tica.
> Universitat de les Illes Balearss.
> Edifici A. Turmeda, Campus de la UIB.
> Crta. de Valldemossa, km. 7,5.
> 07122 Palma de Mallorca.
> Baleares.
> Spain.
> Phone: +34 971 172987
> Fax: +34 971 173003
> e-mail: address@hidden
> web: http://dmi.uib.es/~arnau
>
>
>
> -------------------------------------------------------------
> 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
> -------------------------------------------------------------
>
-------------------------------------------------------------
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
-------------------------------------------------------------
- phase portrait, Arnau Mir Torres, 2005/02/21
- Re: phase portrait,
Peter Gawthrop <=