Use Octave to study the dierential equation x x2 x2 1x x
Use Octave to study the dierential equation x + (x2 + x2 1)x + x = 0 in the phase plane. Hint. Introduce a new variable y = x, getting a system of rst-order equations of the form x 1 = (x2 2 + x2 1 1)x1 x2, x 2 = x1.
i need matlab or octave code
Solution
> >[x,y]=meshgrid(.1:.2:4,.1:.2:4);
> >dx=y; %introducing new variable
> >dy=-(x^2+y^2-1)y-x; % comes frm given equation
> >dyu=dy./sqrt(dy.^2+dx.^2);
> >dxu=dx./sqrt(dy.^2+dx.^2);
> >quiver(x,y,dxu,dyu) %plots phase diagram

