File:Van der pols equation phase portrait.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 438 × 533 pixels, file size: 151 KB)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: Phase portrait of Van der Pol oscillator. Created in python using scipy, numpy and matplotlib libraries.
    Date
    Source Own work
    Author Krishnavedala
    Other versions File:Van_der_pols_equation_phase_portrait.jpg and w:File:Vdppp.jpg
    SVG development
    InfoField
     The SVG code is valid.
     This plot was created with Matplotlib.
    Source code
    InfoField

    Python code

    Source code
    from numpy import *
    from scipy import *
    from scipy.integrate import odeint
    from matplotlib.pyplot import *
    from mpl_toolkits.axes_grid.axislines import SubplotZero
    
    def myFun(u,t=0.,mu=.5):
    	x = u[0]
    	v = u[1]
    	dx = v
    	dv = mu*(1.-x**2)*v-x
    	return (dx,dv)
    
    t = linspace(-5.5,5.5,300)
    u0 = array([1.,1.])
    mu = [.1, .2, .5, 1., 1.5, 2.0]
    fig = figure(figsize=(5.5,7))
    ax = SubplotZero(fig,111)
    fig.add_subplot(ax)
    ax.grid(True)
    for direction in ["right","top"]:
            ax.axis[direction].set_visible(False)
    for m in mu:
    	u = odeint(myFun,u0,t,args=(m,))
    	ax.plot(u[:,0],u[:,1],lw=1.5,label=r'$\mu=%.1f$'%m)
    x = linspace(-3,3,15)
    y = linspace(-4,4,15)
    x,y = meshgrid(x,y)
    X,Y = myFun([x,y])
    M = (hypot(X,Y))
    M[M==0]=1.
    X,Y = X/M, Y/M
    ax.quiver(x,y,X,Y,M,pivot='mid',cmap=cm.jet)
    ax.minorticks_on()
    ax.legend(handletextpad=0,loc='upper left')
    setp(ax.get_legend().get_texts(),fontsize=12)
    fig.savefig("Van_der_pols_equation_phase_portrait.svg",bbox_inches="tight",\
            pad_inches=.15)
    

    Licensing

    I, the copyright holder of this work, hereby publish it under the following licenses:
    w:en:Creative Commons
    attribution share alike
    This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
    You are free:
    • to share – to copy, distribute and transmit the work
    • to remix – to adapt the work
    Under the following conditions:
    • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
    • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
    GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
    You may select the license of your choice.

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    15 June 2011

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current23:01, 24 October 2017Thumbnail for version as of 23:01, 24 October 2017438 × 533 (151 KB)wikimediacommons>Krishnavedalarecreated using updated libraries

    There are no pages that use this file.