Home > atplot > plotfunctions > plot_trajectory.m

plot_trajectory

PURPOSE ^

PLOT_TRAJECTORY Plots particle trajectories

SYNOPSIS ^

function varargout=plot_trajectory(varargin)

DESCRIPTION ^

PLOT_TRAJECTORY    Plots particle trajectories

Helper function for atplot: plot
- H and V trajectories on the left axis

PLOTDATA=PLOT_TRAJECTORY(LINDATA,RING,DPP,IN)

[S,PLOTDATA]=PLOT_TRAJECTORY(RING,DPP,IN)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout=plot_trajectory(varargin)
0002 %PLOT_TRAJECTORY    Plots particle trajectories
0003 %
0004 %Helper function for atplot: plot
0005 %- H and V trajectories on the left axis
0006 %
0007 %PLOTDATA=PLOT_TRAJECTORY(LINDATA,RING,DPP,IN)
0008 %
0009 %[S,PLOTDATA]=PLOT_TRAJECTORY(RING,DPP,IN)
0010 
0011 if nargout == 1     % From atplot
0012     nparts=size(varargin{4},2);
0013     refpts=1:length(varargin{2})+1;
0014     rout=linepass(varargin{[2 4]},refpts);
0015     [xref,zref]=atreforbit(varargin{2});
0016     xx=reshape(rout(1,:),nparts,[])'+xref(:,ones(1,nparts));
0017     yy=reshape(rout(3,:),nparts,[])'+zref(:,ones(1,nparts));
0018     labs=[arrayfun(@(n) num2str(n,'x%d'),1:nparts,'UniformOutput',false),...
0019         arrayfun(@(n) num2str(n,'z%d'),1:nparts,'UniformOutput',false)];
0020     plotdata(1).values=[xx yy];
0021     plotdata(1).labels=labs;
0022     plotdata(1).axislabel='x,z [m]';
0023     varargout={plotdata};
0024 else                % From atbaseplot
0025     s=findspos(varargin{1},1:length(varargin{1})+1);
0026     varargout={s,plot_trajectory([],varargin{:})};
0027 end
0028 end

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005