Code Examples

The code examples make use of OTS — the Optical Trapping Software.

You can leave comments or signal bugs in the comment form below.

Chapter 2 — Ray Optics

Chapter 4 — Optical Beams and Focusing

Chapter 5 — Electromagnetic Theory

Chapter 6 — Computational Methods

Chapter 7 — Brownian Motion

Chapter 9 — Data Acquisition and Optical Tweezers Calibration*

1 file, 2.4 GB

1 file, 46.2MB

1 file, 46.2MB

Chapter 10 — Photonic Force Microscope

Chapter 11 — Wavefront Engineering and Holographic Optical Tweezers*

14 thoughts on “Code Examples”

  1. Hi. I am trying to download trajectory.mat and trajectoryxy.mat but its giving a network error. Other files are downloading easily.

    1. Hi. This sometimes happens because they are large files. I’ve sent you by email some dropbox links to download them.

  2. Hi, I cannot download the either. I think it is due to file size. Is there a solution?!

  3. Could you please give an example of how to model an arbitrary shaped particle for optical tweezing with a focused beam? I only could find examples with predefined 3D shapes that toolbox has, but I am wondering how I should model a different shape.

    1. If you want to do this within the geometrical optics package, you need to implement a new object extending “Particle” and implementing the abstract methods. In fact, the objects “ParticleSpherical”, “ParticleCylindrical” and “ParticleEllipsoidal” are examples of this process.

  4. It looks there is no function “BrownianMotion1DOT”.
    How can I work the code in Chapter 7 “Brownian motion”?

    Thank you

  5. Hello Prof. Volpe,
    I am very delighted to read the book and solve the constituting tutorial. I would like to ask a question regarding the phase mask that we project on a spatial light modulator.
    I am working with holographic tweezer and wrote a code using GS Algorithm as described in Chapter-11. I found that at every instant of time I run code, the phase mask is different as the initial random phase are different. Interestingly, the desired pattern is obtained.
    Is this obvious or It can be solved.
    Your suggestion would be helpful

    1. Hi,

      Thank you for your feedback and question.

      Yes, you are right that the GS algorithm is stochastic and will produce different phase mask each time it’s run. In fact, multiple phase mass produce the same intensity (e.g., think of a grating and its translations). Therefore, this is not a problem, just a feature of phase masks.

  6. Hello Prof. Volpe,
    Thank you so much for providing such a comprehensive set of matlab implemented codes for such applied examples and your kind attitude to make them free to access.
    I cannot download these files:
    It would be so appreciated if you help me.
    Thanks again.
    Best regards.

  7. focustm.m – Force on a sphere by a focused beam,
    in this section it shows like this
    Unrecognized function or variable ‘BeamGauss’.

    Error in focustm (line 34)
    b = BeamGauss(Ex0,Ey0,w0,R,Nphi,Nr);
    how to resolve these things sir.

Leave a Reply