User Tools

Site Tools


big_display_matlab_code

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
big_display_matlab_code [2015/05/08 14:50]
miles90
big_display_matlab_code [2015/05/08 14:58] (current)
miles90
Line 1: Line 1:
-I have not yet included all necessary file; instead i've included the most important files as examples. 
  
 ==mask_draft1.m== ==mask_draft1.m==
Line 15: Line 14:
     DmakeDevice_1Tgrating(400,​200,​80,​2500,​fid,​xbias,'​test_low_freq17'​)     DmakeDevice_1Tgrating(400,​200,​80,​2500,​fid,​xbias,'​test_low_freq17'​)
     DXF_end(fid) %where the dxf file is written     DXF_end(fid) %where the dxf file is written
 +    ​
 +==DmakeDevice_1Tgrating.m==
 +
 +    function out=DmakeDevice_1Tgrating(startf,​stopf,​xscale,​yscale,​fid,​xbias,​name)
 +    %units are inches in cad and microns in final program
 +    lambda=633e-9;​
 +    n_e=2.3;
 +    % start center stop frequency
 +    vxeff=3960;​%effective velocities from experimental data (accounting for reflection)
 +    vyeff=4500;
 +    vy=3909; %freespace velocity
 +    FV1=[430,​490]*1e6;​
 +    %freq=120;
 +     ​FH1=[startf,​stopf]*1e6;​
 +     ​FH2=[150,​150]*1e6;​
 +     ​FH3=[200,​200]*1e6;​
 +     ​FH4=[250,​250]*1e6;​
 +     ​FH5=[300,​300]*1e6;​
 +     ​FH6=[400,​400]*1e6;​
 +     ​FH7=[500,​500]*1e6;​
 +     ​FH8=[600,​600]*1e6;​
 +     ​FH9=[700,​700]*1e6;​
 +     ​FH10=[800,​800]*1e6;​
 +    Fcomb=[FH1;​FH2;​FH3;​FH4;​FH5;​FH6;​FH7;​FH8;​FH9;​FH10];​
 +    Fc=(Fcomb(:,​1)+Fcomb(:,​2))./​2;​
 +    Bragg=asind(lambda*Fc./​(2*vy*n_e));​
 +    biasf=700*1e6;​
 +    biasb=asind(lambda*biasf./​(2*vy*n_e));​
 +    bias_offset=2*biasb;​
 +    Bragg=bias_offset-Bragg;​
 +    %make a bias at
 +    startl=vy./​(4*Fcomb(:,​1));​
 +    startl=startl*1e6;​
 +    vstartl=vxeff./​(4*FV1(1));​
 +    vstartl=vstartl*1e6;​
 +    stopl=vy./​(4*Fcomb(:,​2));​
 +    stopl=stopl*1e6;​
 +    vstopl=vxeff./​(4*FV1(2));​
 +    vstopl=vstopl*1e6;​
 +    startl
 +    stopl
 +    sense='​c';​ %clockwise for '​c',​ counterclockwise for '​cc'​
 +    vertex='​tr';​
 +    %N=200;
 +    %xscale=100;​
 +    paddim=10; %this is the length and width of the pad?
 +    buswidth=10;​
 +    %yscale=2000;​
 +    ydim=yscale/​4;​%period size
 +    %fprintf(fid,'​****HCHIRP DATA**** \n sense %s\n vertex %s\n xscale %g\n paddim %g\n buswidth %g\n ',​sense,​vertex,​xscale,​ paddim, buswidth);
 +    HTnum=size(Fcomb(:,​1));​
 +    for index=1:​1%HTnum %NUMBER OF ROWS, why does it make the 2nd row offset to the left?
 +       % DXFTRYgrating(fid,​sense,​vertex,​ N,​xscale,​Bragg(index),​startl(index),​stopl(index),​paddim,​buswidth,​index);​
 +    N=round(ydim/​mean([startl(index),​stopl(index)]));​
 +     ​%N=100;​%************************************************Change THIS***************  ​
 +       ​DXFTRYgrating(xbias,​fid,​sense,​vertex,​ N,​xscale,​90',​startl(index),​stopl(index),​paddim,​buswidth,​index);​ %do i need the apostrophy after theta?
 +    end
 +    end
 +    ​
 +==Dmakerect.m==
 +    function out=Dmakerect(sense,​vertex)
 +    %returns a box expressed as a 2xN matrix of coors starting at the specified
 +    %vertex: tr, tl, br, bl
 +    %and drawn in the given sense: c, cc etc.
 +    %canonx=[0,​0,​1,​1];​ %clockwise bottom left
 +    %canony=[0,​1,​1,​0];​
 +    canonx=[0,​0,​250,​250];​ %this is for the wirebonding pads/busses %250 makes it 2500um long, 3 makes 30um high
 +    canony=[0,​9,​9,​0];​
 +    canoncoors=[canonx;​canony];​
 +    %********Starting Point and Sense*******
 +    switch vertex
 +       case {'​tr','​topright'​}
 +          if sense=='​clockwise'​|'​c'​| '​clk'​ | '​clock'​
 +            canoncoors=circshift(canoncoors,​[1,​2]);​
 +            canoncoors=[canoncoors,​canoncoors(:,​1)];​%first point becomes last point
 +          else
 +            canoncoors=circshift(fliplr(canoncoors),​[1,​1]);​
 +            canoncoors=[canoncoors,​canoncoors(:,​1)];​%first point becomes last point
 +          end
 +          %disp('​start top right'​)
 +       case {'​tl','​topleft'​}
 +          if sense=='​clockwise'​|'​c'​|'​clk'​ | '​clock'​
 +            canoncoors=circshift(canoncoors,​[1,​1]);​
 +            canoncoors=[canoncoors,​canoncoors(:,​1)];​%first point becomes last point
 +          else
 +            canoncoors=circshift(fliplr(canoncoors),​[1,​2]);​
 +            canoncoors=[canoncoors,​canoncoors(:,​1)];​%first point becomes last point
 +          end
 +          %disp('​start top left')
 +       case {'​br','​bottomright'​}
 +          if sense=='​clockwise'​|'​c'​|'​clk'​ | '​clock'​
 +            canoncoors=circshift(canoncoors,​[1,​3]);​
 +            canoncoors=[canoncoors,​canoncoors(:,​1)];​%first point becomes last point
 +          else
 +            canoncoors=circshift(fliplr(canoncoors),​[1,​0]);​
 +            canoncoors=[canoncoors,​canoncoors(:,​1)];​%first point becomes last point
 +          end
 +          %disp('​start bottorm right'​)
 +       case {'​bl','​bottomleft'​}
 +          if sense=='​clockwise'​|'​c'​|'​clk'​ | '​clock'​
 +            canoncoors=circshift(canoncoors,​[1,​0]);​
 +            canoncoors=[canoncoors,​canoncoors(:,​1)];​%first point becomes last point
 +          else
 +            canoncoors=circshift(fliplr(canoncoors),​[1,​3]);​
 +            canoncoors=[canoncoors,​canoncoors(:,​1)];​%first point becomes last point
 +          end
 +          %disp('​start bottom left')
 +    end
 +    %********
 +    out=canoncoors;​
big_display_matlab_code.1431118212.txt.gz · Last modified: 2015/05/08 14:50 by miles90