0001 function varargout=plot_trajectory(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 if nargout == 1
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
0025 s=findspos(varargin{1},1:length(varargin{1})+1);
0026 varargout={s,plot_trajectory([],varargin{:})};
0027 end
0028 end