At Plot Functions

We use the atplot function to plot many different functions around the ring.
One can define any function of the ring, and use atplot to plot it, together with a
representation of the lattice elements.

plenvelope is an envelope plotting routine
plTouschek is for plotting functions relevant for the Touschek Lifetime.

For example:
atplot(esrf(:),[0,52],@plenvelope)

Here is the envelope plotting function plenvelope:
function plotdata=plenvelope(lindata,ring,dpp,varargin) %#ok<INUSD>
%DEFAULTPLOT Default plotting function for ATPLOT
%
%Plots beta-functions on left axis and dispersion on right axis

varargin

if length(varargin)<3

atxdata=atx(ring,dpp,1:length(ring)+1);
sig2=cat(3,atxdata.beam66);
sigx2=sig2(1,1,:);
sigx2=squeeze(sigx2);
sigx=sqrt(sigx2);
sigy2=sig2(3,3,:);
sigy2=squeeze(sigy2);
sigy=sqrt(sigy2);
%a=permute(sig,[3 2 1]);
else
epsx=varargin{1};
epsy=varargin{2};
sig_delta=varargin{3};

beta = cat(1,lindata.beta);
betax= beta(:,1);
betay= beta(:,2);
dispersion=cat(2,lindata.Dispersion)';
etax=dispersion(:,1);
etay=dispersion(:,3);

sigx = sqrt(epsx*betax+sig_delta^2*etax.*etax);
sigy = sqrt(epsy*betay+sig_delta^2*etay.*etay);
end

plotdata(1).values=sigx;
plotdata(1).labels={'sigx'};
plotdata(1).axislabel='[m]';

plotdata(2).values=sigy;
plotdata(2).labels={'sigy'};
plotdata(2).axislabel='[m]';
end


Here is the help for atplot:
ATPLOT Plots optical functions

ATPLOT Plots THERING in the current axes

ATPLOT(RING) Plots the lattice specified by RING

ATPLOT(AX,RING) Plots in the axes specified by AX

ATPLOT(AX,RING,DPP) Plots at momentum deviation DPP

ATPLOT(…,[SMIN SMAX]) Zoom on the specified range

ATPLOT(…,@PLOTFUNCTION,args…)
Allows for a user supplied function providing the values to be plotted
PLOTFUNCTION must be of form:
PLOTDATA=PLOTFUNCTION(LINDATA,RING,DPP,args…)

PLOTDATA is a structure array,
PLOTDATA(1) describes data for the left axis
PLOTDATA(1).VALUES: data to be plotted length(ring)+1 X nbcurve
PLOTDATA(1).LABELS: curve labela, cell array, 1 X nbcurve
PLOTDATA(1).AXISLABEL: string
PLOTDATA(2) optional, describes data for the left axis

The default function displayed below as an example plots beta functions
and dispersion

function plotdata=defaultplot(lindata,ring,dpp,varargin)
beta=cat(1,lindata.beta); % left axis
plotdata(1).values=beta;
plotdata(1).labels={'\beta_x','\beta_z'};
plotdata(1).axislabel='\beta [m]';
dispersion=cat(2,lindata.Dispersion)'; % right axis
plotdata(2).values=dispersion(:,1);
plotdata(2).labels={'\eta_x'};
plotdata(2).axislabel='dispersion [m]';
end

CURVE=ATPLOT(…) Returns handles to some objects:
CURVE.LEFT Handles to the left axis plots
CURVE.RIGHT Handles to the right axis plots
CURVE.LATTICE Handles to the Element patches
CURVE.COMMENT Handles to the Comment text

See also: atplot>defaultplot

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License