function phaseportrait(data_filename, XLABEL, YLABEL, TITLE) %plots a phase portrait, i.e. the velocity of a particle as a function of its position %first, load your data from the trajectory file: load(data_filename) %The 2 loaded veriables are called X and X_DOT. % -- X is a matrix where each column is the position evolution for a given % set of initial conditions. % -- X_DOT is a matrix where each column is the velocity evolution for a given % set of initial conditions. %plot also accept 2 matrices as arguments X_DATA, and Y_DATA or %same size, and %plots as many curves as there are columns, the %data in each column being the x-coordinates and the y-coordinates %of the points to be plotted: plot(X, X_DOT) %standard labeling and title: xlabel(XLABEL); ylabel(YLABEL); title(TITLE);