; 2011 | Michael Ian Lapsley

[Matlab] Training from Steven

here is the link - http://goo.gl/Lu7Qg

Styles for BibTeX4word - Custom and modified .bst files using windows

I am using Microsoft Windows 7 (and Windows XP at home) and I use Word to create documents.  You must first be familiar with Word, Jabref, MikTex, and Bibtex4word before this will make sense. Start by reading the Bibtex4word documentation. These three programs will allow you to automatically create bibliographies in word.

Here is a manual for Miktex

Below is a list of style types that I use regularly:
  • ieeetr/cn^s - good for most conferences
  • phaip/cn[]^s - actual APL (AIP) file but use et al. for over 5 name which APL does not allow.
  • phjcp/cn[]^s - like APL and does not use et al. but has lower caps in names. ~ this can be made to match APL almost perfectly if you highlight all of the references, press ctrl+d, uncheck the small caps option.
  • phnflet - like APL without et al. but uses all caps and DOI in wrong place.

  • rsc/cn[]^s - RSC reference type such as Lab on a Chip
  • achemso/cn[]^s - America chemical society
Other people have more comprehensive lists of styles:
  • http://www.ee.ic.ac.uk/hp/staff/dmb/perl/index.html
  • http://web.reed.edu/cis/Help/LaTeX/bibtexstyles.html 
Most Journals have a style. It is best to find one that already exists because modifying and creating them is a real pain.
    Modifying .bst files:

    The first thing to know about this is that it is really anoying. I have been trying to figure this out for weeks and still have had little luck. There are many many websites that give information, but must of the time it is not that helpful.

    Finding my .bst files: This is much more difficult that it seems. I though they would be in the "Program Files/miketex2.8" folder. Nope. I finally found them in:

    "C:\Users\UserName\AppData\Roaming\MiKTeX\2.8\bibtex" ~ in Windows 7
    "C:\Documents and Settings\UserName\Application Data\MiKTeX\2.8\bibtex\bst" ~ in Windows XP

    thanks to some hits from this link.



      [Matlab] Loading Large Data Sets

      The Old Way to Load DataSets

      Lots of my time consists of analyzing huge sets of files recorded by and oscilloscope or some other device. Typically, I would try to use the same name for each file with a number at the end that increase each time. Then I can write a loop to load all of the files, then do analysis and create plots. This causes its own problems for several reasons such as: several loops must be used for different regions of the data (tek0000n for n = 1-9; tek000nn for nn = 10-99; tek00nnn for nnn = 100-999; etc) and broken loops when a single file in the data set is a different length or mission, and many other issues. Such a sustem looks like this where many conditional loops are used to fix the problem:

      if m <10 & n < 10
         for i = 1:n
             Temp = dlmread([File,'/',File,'-0000',num2str(i),'.txt'],'\t',[17 0 3664 1]);
             Frequency(:,i) = Temp(:,1);
             Absorption(:,i) = Temp(:,2);
         end
      end

      if m <10 & n < 100 & n > 10
         for i = 1:9
             Temp = dlmread([File,'/',File,'-0000',num2str(i),'.txt'],'\t',[17 0 3664 1]);
             Frequency(:,i) = Temp(:,1);
             Absorption(:,i) = Temp(:,2);
         end
                 
         for i = 10:n
             Temp = dlmread([File,'/',File,'-000',num2str(i),'.txt'],'\t',[17 0 3664 1]);
             Frequency(:,i) = Temp(:,1);
             Absorption(:,i) = Temp(:,2);
         end
      end
             
      if m <10 & n < 1000 & n > 100
         for i = 1:9
             Temp = dlmread([File,'/',File,'-0000',num2str(i),'.txt'],'\t',[17 0 3664 1]);
             Frequency(:,i) = Temp(:,1);
             Absorption(:,i) = Temp(:,2);
         end
                 
         for i = 10:99
             Temp = dlmread([File,'/',File,'-000',num2str(i),'.txt'],'\t',[17 0 3664 1]);
             Frequency(:,i) = Temp(:,1);
             Absorption(:,i) = Temp(:,2);
         end
                 
         for i = 100:n
             Temp = dlmread([File,'/',File,'-00',num2str(i),'.txt'],'\t',[17 0 3664 1]);
             Frequency(:,i) = Temp(:,1);
             Absorption(:,i) = Temp(:,2);
         end
      end
             
      if m > 10 & n < 1000 & n > 100
         for i = m:99
             Temp = dlmread([File,'/',File,'-000',num2str(i),'.txt'],'\t',[17 0 3664 1]);
             Frequency(:,i) = Temp(:,1);
             Absorption(:,i) = Temp(:,2);
         end
                 
         for i = 100:n
              Temp = dlmread([File,'/',File,'-00',num2str(i),'.txt'],'\t',[17 0 3664 1]);
              Frequency(:,i) = Temp(:,1);
              Absorption(:,i) = Temp(:,2);
         end
      end
             
      if m < 10 & n > 1000
         for i = 1:9
             Temp = dlmread([File,'/',File,'-0000',num2str(i),'.txt'],'\t',[17 0 3664 1]);
             Frequency(:,i) = Temp(:,1);
             Absorption(:,i) = Temp(:,2);
         end
                
         for i = 10:99
             Temp = dlmread([File,'/',File,'-000',num2str(i),'.txt'],'\t',[17 0 3664 1]);
             Frequency(:,i) = Temp(:,1);
             Absorption(:,i) = Temp(:,2);
         end
                 
         for i = 100:999
             Temp = dlmread([File,'/',File,'-00',num2str(i),'.txt'],'\t',[17 0 3664 1]);
             Frequency(:,i) = Temp(:,1);
             Absorption(:,i) = Temp(:,2);
         end  
      end

      Read Directory and Load

      Recently, google helped me discover a better method where you can actually tell matlab to read and record the files names in a specific folder. The, so long as all the data is the same length, a single loop can be used to import all of the data in a single folder. Here is an example:

      clear;clc;close all

      cd ..
      Temp = dir('Data');
      Temp2 = {Temp.name};
      FileName = Temp2(3:end);

      for i = 1:length(FileName)
          Temp = dlmread(['Data/',char(FileName(i))],',',[14 0 10013 2]);
          time = Temp(:,1);
          ch1 = Temp(:,2);
          ch2 = Temp(:,3);
          save(['[Matlab]/MData/DataSet',num2str(i),'.mat'],'time','ch1','ch2')
      end

      return


      The dir command reads the folder \Data, and a structure cell is created with the information for each file. Since I only care about the name, that cell can be extracted and trimmed. Then a single loop can be used to load all of the data into a useful format. To prevent errors if the files are not the same length, each data set is save in its own .mat file. These files can be quickly loaded in Matlab for later use.

      Loading several .mat files

      Once all of the data is stored in separate .mat files, this data can be easily accessed and plotted. It one were to plot the first 5 data sets that were loaded above, this code would perform the operation:


      for i = [1:5]
          Str = ['MData\DataSet',num2str(i),'.mat'];
          load(Str)
          eval(['time_',num2str(i),' = time;'])
          eval(['ch1_',num2str(i),' = ch1;'])
          eval(['ch2_',num2str(i),' = ch2;'])
      end

      figure
      hold on
              
      for i = 1:5
          eval(['plot(time_',num2str(i),',ch1_',num2str(i),')'])
      end

      hold off

      I realize that there are many non standard matlab functions here, but I encourage people to learn these functions. They have been very useful for me in performing some more advanced actions.



      HTML / Javascript equation solver

      I always wanted to do simple calculations in HTML and create simple online equation solvers. I spent some time on it and have created a simple equation solver. I have include the code here with lots of comments to try and help others who might want to learn. The biggest issue I had was with the button. I had to use a form input of type button rather than a button element (<button></button>). the button element would run the code but then reset everything to the defaults immediately. I still do not understand why. If you want to try this code, copy and past it into notepad and save as a .html file. Then open the file in an internet browser. Questions and comments are welcome.

      Here is the equation solver:
      a:   
      b:    
      Solution to a + b:
      Output:    



      Here is the source code:
      -------------------------------------------------------
       <! comments look like this. They are just here to help the programmer>
          <! This program has embedded java scripts to solve an equation with certain inputs>
      <form name="F1">  <! gives the form a name so it can be referenced by the java script>
          a:            <! text in front of input a>
          &nbsp;            <! adds a space after a:>
          &nbsp;            <! adds another space>
          <input            
              type = "text"   
              name = "a"   
              value = "12"   
              size = "4"  
              />        <! creates input a>
                      <! makes input a a text box>
                      <! names input a a>
                      <! sets the initial value of input a>
                      <! sets the size of input a>
                      <! ends the seting for input a>
          <br />             <! move to next line>
         
          b: &nbsp;&nbsp;&nbsp;
          <input
              type = "text"
              name = "b"
              value = "100"   
              size = "4"
              />   
          <br />
          <br />
         
          <b> Solution to a + b: </b>
         
          <br />
          <br />
          Output: &nbsp;&nbsp;&nbsp;
          <input
              type = "text"
              name = "out"
              value = ""   
              size = "10"
              />   

          <br />
          <br />
          <input
              type = "button"
              value = "Calculate"
              onClick = "clickButton1()"       
              >        <! Creates a button and assigns its properties>
          </form>            <! end of form-F1>


          <script
              type ="text/javascript">                    // starts the imbedded javascript
             
                                  // comments look like this in java script
              function clickButton1()
              {
                  var a = document.F1.a.value; //sets variable a = the contents of input/textbox a
                  a = parseFloat(a); // convers a from a string to a floating number
                  var b = document.F1.b.value;
                  b = parseFloat(b);
                  var c = a + b;
                  document.F1.out.value = c;
                 
              }
          </script>                            <! ends the script section of the file>

      </html>


      ----------------------------------------------------------

      Two Beam Interference Derivation

      Derivation of the Two Beam Interference Equation2

      Refractive Index of Water

      Due to the effects of optical dispersion, the refractive index of water is dependent on the wavelength of light being used. After a long search, I found a good reference for this information (Daimon and Masumura). here is a plot of their data in the visible range:


      Matlab was used to fit a exponential decay function to the 20oC data:

      y = a e-bx  + c
      where:
      a = 0.1140
      b = 0.0048
      c = 1.3264

      Here is a plot of the fit with the data:

      ****NOTE** This fit is only valid from 400 nm to 800 nm and is not perfect ****
      Here is a Calculator to solve this fit:

      Equation Solver

      This program solves ae-bx + c using java script imbedded in HTML. This is intended to solve the exponential function to determine the refractive index of water at different wavelengths.
      Here are the inputs:
      a:
      b:  
      c:  
      x:  
      (wavelength of light in nanometers)
      Solution to ae-bx + c:
      Output:  

      Calcium Chloride (CaCl2) Useful Information

      Refractive Index

      Refractive index is a bulk material property. This property has a real and imaginary part and is dependent on wavelength. The real part describes how light "slows down" or "scatters" in a material and the imaginary part indicates how the material adsorbs light.

      Typically, a single real value of refractive index will be attributed to a "transparent" dielectric material. If a material is transparent to your eye then we can assume that the imaginary part of the refractive index is close to zero. Also, in many cases, one may not want to consider the absorption of a material, only its scattering (reflection, refraction, transmission, diffraction, etc). Whenever a single value of refractive index is given with no wavelength specification, a good assumption is that the value was taken at a wavelength of 589.29 nm. This is the sodium D transition, and is typically used as the "standard" for refractive index values.

      Now, for CaCl2, the refractive index changes with molar concentration. This is true for most salt solutions. CaCl2 is used in may optofluidic applications for its large refractive index range, and its stability. CaCl2 does not evaporate easily (so no crusty solids under the caps of your containers). So samples will remain good for long periods of time. The refractive index of CaCl2 is available in the CRC handbook of Chemistry and physics. Below is a plot of this data with two fitting functions. Many studies use a linear fit because it is convenient for calibrating devices. However, a second order polynomial has almost a perfect fit. * Remember this data is the refractive index at 589.29 nm. *

      Linear Fit:

      a x + b
      where:
      a = 0.022
      b = 1.3353

      Polynomial fit:

      a x2 + b x + c
      where:
      a = -7.871 x 10-4
      b = 0.0256
      c = 1.3331

      Equation Solver

      This program solves ax2 + bx + c using java script imbedded in HTML.
      This is intended to solve the second order polynomial to determine the refractive index of
      calcium chloride.

      Here are the inputs:


      a:  

      b:   

      c:  

      x:  
      (Concentration of CaCl2 in M)

      Solution to ax2 + bx + c:

      Output:  




      The molarity of CaCl2 needed to match the RI of PDMS is about 3.5M (n ~ 1.41)

      Molar Concentration 

      Mass Needed [g] = desired Molarity [mol/L] * Molecular Weight [g/mol] * desired volume [L]
      Example:
      To get 0.25M solution of CaCl2*2H2O (MW = 147.01) in 0.05L
      m [g] = 0.25[mol/L] *147.01[g/mol] * 0.05[L] = 1.838 [g]

      Dilution of a solution

      M1V1=M2V2
      Where M1 is the initial concentration to be diluted, V1 is the volume of solution one to add to the dilution, M2 is the desired concentration and V2 is the total final volume of the dilute solution (V1 of M1 plus V2-V1 of DI water).

      Converting from %Weight to Molarity

      Molarity = (%Weight)/100*(Density)/(MolarMass)
      This does not seem to account for the the change in density due to addition of the solute if you use the density of water. I tried to use an average for the density of water and of hydrated CaCl2 but this seem to be even worse. Use just the density of water seems to match well with other references.

      Resume

      MICHAEL IAN LAPSLEY
      MIL112@psu.edu | 705 N 4th St., Bellwood, PA 16617 | (260) 437-5264
      My goal is to advance the fields of Optofluidics, Nanotechnology and Photonics through related research efforts.

      Education
      Doctor of Philosophy in Engineering Science – Expected in May 2012
      The Pennsylvania State University, University Park, PA
      GPA: 3.9/4.00
      Bachelor of Science in Biomedical Engineering - Graduated cum laude in March 2007
      Rose-Hulman Institute of Technology, Terre Haute, IN
      Minor: Electrical Engineering; Concentration: Bioinstrumentation
      GPA: 3.57/4.00

      Work Experience
      Graduate Research 9/27/07 – Present
      • Acquired skills in chemistry, photonics, microfabrication, electronics, fluid systems and biology.
      • Proficient with matlab and novice in visual C# programming languages
      Research Engineer at TRS Technologies, State Collage, PA 5/7/9 - Present
      • Developed technical reports, proposals and presentations for NASA and DoD SBIR programs.
      • Conducted electrical design of logic and high-voltage circuits for driving piezoelectric actuators and motors.
      • Designed devices and testing systems for high temperature and cryogenic piezoelectric devices.
      Graduate Teaching Assistant 8/27/07 – 5/7/09
      MEMS Laboratory Technician at Rose-Hulman IT, Terre Haute, IN 3/5/07 – 8/10/07
      Systems Engineer at ICTT, Terre Haute, IN 6/1/06 – 8/20/06

      Journal Publications
      • Michael Ian Lapsley, I.-Kao Chiang, Yue Bing Zheng, Xiaoyun Ding, Xiaole Mao and Tony Jun Huang. A single-layer, planar, optofluidic Mach–Zehnder interferometer for label-free detection, Lab on a Chip, 2011, DOI: 10.1039/c0lc00707b.
      • Michael Ian Lapsley, Xiaole Mao, Sz-Chin Lin and Tony Jun Huang. In plane, variable optical fiber attenuator using a tunable reflective interface, Applied Physics Letters, 2009, 95, 083507.
      • Xiaole Mao, Sz-Chin Lin, Jinjie Shi, Michael Lapsley, Bala Juluri, and Tony Jun Huang. Tunable Liquid Gradient Refractive Index (L-GRIN) lens with two degrees of freedom, Lab on a Chip, 2009, 9, 2050 - 2058, DOI: 10.1039/b822982a.
      • Xiaole Mao, Bala Juluri, Michael Lapsley, and Tony Jun Huang. Microseconds microfluidic chaotic bubble mixer, Microfluidics and Nanofluidics, 2010, 8, 139-144, DOI: 10.1007/s10404-009-0496-4.
      • S. Zhang; Xiaoning Jiang, Michael Lapsley, Paul Moses and Thomas Shrout, Piezoelectric accelerometers for ultrahigh temperature application, Applied Physics Letters, 2010, 96, 013506
      Conference Publications
      • Xiaole Mao, Bala Krishna Juluri, Michael Lapsley, and Tony Jun Huang, A Fast Micromixer and Microreactor Based on Dynamic Self-Assembly of Monodisperse Microbubbles, the 2008 ASME International Mechanical Engineering Congress & Exposition, Boston, MA, November 2-6, 2008.
      • Xiaole Mao, Michael Lapsley, John Waldeisen, and Tony Jun Huang, An Opto-Fluidic Hybrid System for Miniaturized Flow Cytometry: Focusing of Cells and Light on Microscale, the 2008 ASME International Mechanical Engineering Congress & Exposition, Boston, MA, November 2-6, 2008. 
      Honors/Activities
      • 2010-2012 NASA PSGC Fellowship
      • 2009-2011 ESM Today Symposium - 2nd ,3rd, and 2nd Place.
      • 2007-2008 Paul H. Schweitzer Memorial Graduate Fellowship and Harry G. Miller Fellowship
      • 2007 Passed the Fundamentals of Engineering Exam
      • 2006 President of Delta Sigma Phi Fraternity

      LGRIN Lens



      We report a tunable optofluidic microlens configuration named the Liquid Gradient Refractive Index (L-GRIN) lens for focusing light within a microfluidic device. The focusing of light was achieved through the gradient refractive index (GRIN) within the liquid medium, rather than via curved refractive lens surfaces. The diffusion of solute (CaCl2) between side-by-side co-injected microfluidic laminar flows was utilized to establish a hyperbolic secant (HS) refractive index profile to focus light. Tailoring the refractive index profile by adjusting the flow conditions enables not only tuning of the focal distance (translation mode), but also shifting of the output light direction (swing mode), a second degree of freedom that to our knowledge has yet to be accomplished for in-plane tunable microlenses. Advantages of the L-GRIN lens also include a low fluid consumption rate, competitive focusing performance, and high compatibility with existing microfluidic devices. This work provides a new strategy for developing integrative tunable microlenses for a variety of lab-on-a-chip applications.
       



      Figure: Principle and design of the L-GRIN lens. (A) A schematic diagram showing the comparison between the classic refractive lens (A1) and GRIN lens (A2). Change of the refractive index contrast in GRIN lens can result in change of focal distance (A2–A3), and shift of optical axis can result in change of output light direction (A4). (B) Schematic of the L-GRIN lens design (B1), microscopic image of the L-GRIN lens in operation (B2, left), and the expected refractive index distribution at two locations (I and II) inside the lens (B2, right). High optical contrast areas (dark streaks) were observed near the fluidic boundaries (B2, left), suggesting significant variation of refractive index due to the CaCl2 diffusion. (C) Schematic drawing showing two operation modes of the L-GRIN lens: the translation mode with variable focal length including no-focusing (C1), a large focal distance (C2), and a small focal distance (C3); and the swing mode with variable output light direction (C3–C5).