Home > atdemos > trackWithImpedance > bbr_gentab.m

bbr_gentab

PURPOSE ^

xr is extent of wake function in m

SYNOPSIS ^

function [ s,bbrx,bbry,bbrz ] = bbr_gentab(xr,npoints,freqx,freqy,freqz,qx,qy,qz,rx,ry,rz)

DESCRIPTION ^

xr is extent of wake function in m
npoints is number of points in table
freq in GHz
Rshunt in MOhm

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ s,bbrx,bbry,bbrz ] = bbr_gentab(xr,npoints,freqx,freqy,freqz,qx,qy,qz,rx,ry,rz)
0002 %xr is extent of wake function in m
0003 %npoints is number of points in table
0004 %freq in GHz
0005 %Rshunt in MOhm
0006 
0007 %Based on equations 2.84 and 2.88 in Chao's 'Physics of Collective Instabilities'
0008 
0009 clight = 2.99792458e8;
0010 if mod(npoints,2) == 0
0011     npoints=npoints+1;
0012 end
0013 
0014 s = linspace(-xr,xr,npoints);
0015     
0016 omegarx = 2.0*pi*freqx*1.0e9;
0017 alphax = omegarx/(2.0*qx);
0018 omegabarx = sqrt(omegarx*omegarx-alphax*alphax);
0019 
0020 omegary = 2.0*pi*freqy*1.0e9;
0021 alphay = omegary/(2.0*qy);
0022 omegabary = sqrt(omegary*omegary-alphay*alphay);
0023 
0024 omegarz = 2.0*pi*freqz*1.0e9;
0025 alphaz = omegarz/(2.0*qz);
0026 omegabarz = sqrt(omegarz*omegarz-alphaz*alphaz);
0027 
0028 bbrx=zeros(length(s),1);
0029 bbry=zeros(length(s),1);
0030 bbrz=zeros(length(s),1);
0031 
0032 for i = 1:length(s)
0033     %chao 2.88
0034     %chao 2.84
0035     if s(i)==0.0
0036         bbrz(i)=rz*1e6*alphaz;
0037         bbrx(i)=0.0;
0038         bbry(i)=0.0;    
0039     elseif s(i)<0.0
0040         bbrx(i)=0.0;
0041         bbry(i)=0.0;
0042         bbrz(i)=0.0;
0043     else
0044         bbrx(i) = rx*1e6*omegarx*omegarx/qx/omegabarx*exp(alphax*(-s(i))/clight)*sin(omegabarx*(-s(i))/clight);
0045         bbry(i) = ry*1e6*omegary*omegary/qy/omegabary*exp(alphay*(-s(i))/clight)*sin(omegabary*(-s(i))/clight);
0046         bbrz(i) = rz*1e6*2.0*alphaz*exp(alphaz*(-s(i))/clight)*(cos(omegabarz*(-s(i))/clight) + ...
0047                alphaz/omegabarz*sin(omegabarz*(-s(i))/clight)); 
0048     end
0049 end
0050 
0051 end

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