Home > pubtools > LatticeTuningFunctions > errors > LargeWaveList > testcor.m

testcor

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 clear all
0002 close all
0003 
0004 addpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/errors')
0005 addpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/errors/wave')
0006 addpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/errors/random')
0007 addpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/errors/errordisplayfunctions');
0008 
0009 % load lattice
0010 load ../../ESRFLattice.mat
0011 r0=ring;
0012 
0013 % wave errors
0014 ie=1;
0015 
0016 wltouse=1:0.5:3;
0017 amplx=0.6e-3;
0018 amplY=0.6e-3;
0019 amplpsi=0.6e-3;
0020 
0021 W=findspos(r0,length(r0)+1)./wltouse;
0022 
0023 A=amplx/length(W)*randn(size(W));
0024 errwavestruct(ie).indx=1:length(r0);%findcells(r0,'Class','Quadrupole');
0025 errwavestruct(ie).type='x';
0026 errwavestruct(ie).A=A(end:-1:1);
0027 errwavestruct(ie).W=W;
0028 ie=ie+1;
0029 
0030 A=amplY/length(W)*randn(size(W));
0031 errwavestruct(ie).indx=1:length(r0);%findcells(r0,'Class','Quadrupole');
0032 errwavestruct(ie).type='y';
0033 errwavestruct(ie).A=A(end:-1:1);
0034 errwavestruct(ie).W=W;
0035 ie=ie+1;
0036 
0037 A=amplpsi/length(W)*randn(size(W));
0038 errwavestruct(ie).indx=1:length(r0);%findcells(r0,'Class','Quadrupole');
0039 errwavestruct(ie).type='psi';
0040 errwavestruct(ie).A=A(end:-1:1);
0041 errwavestruct(ie).W=W;
0042 ie=ie+1;
0043 
0044 magindex=arrayfun(@(a)a.indx,errwavestruct,'un',0);
0045 type=arrayfun(@(a)a.type,errwavestruct,'un',0);
0046 A=arrayfun(@(a)a.A,errwavestruct,'un',0);
0047 W=arrayfun(@(a)a.W,errwavestruct,'un',0);
0048 
0049 rerr=atsetwaveerrors(...
0050     r0,...
0051     magindex,...
0052     findcells(r0,'Class','Monitor'),...
0053     W,...
0054     A,...
0055     type);
0056 
0057     
0058 figure('units','normalized','position',[0.1 0.4 0.65 0.35])
0059 atplot(rerr,'comment',[],@pltmisalignments);
0060 saveas(gca,'Wave.fig')
0061 export_fig('Wave.jpg','-r300')
0062

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