File Exchange

image thumbnail


version 3.16 (3.42 MB) by

An optical FFT code to simulate Fabry Perot cavities with arbitrary mirror profiles

7 Ratings



View License

OSCAR is an optical FFT code used to calculate the steady state optical field circulating in Fabry Perot cavities. The code can integrate non-sperical mirrors and any arbitrary input fields. Recent applications for OSCAR have been: calculation of thermal lensing effect and calculation of diffraction loss and cavity eigen modes for mesa beams. One great advantage of OSCAR is the simplicity and flexibility of the code, everyone with only minimal knowledge of Matlab can easily modified OSCAR code to suit specific purposes.

Comments and Ratings (21)

Jerome Degallaix

Thanks for spotting that. It will be fixed in the next release.

Dear Jerome,

line 13 of function LoadZygoBinary, I believe you meant error(msg); rather than error('msg'); ? It leads to a bug in my case.

Thanks !

Sha Wang

Found them in Version 1. Thank you! great work!!!!

Sha Wang

Dear Jerome,
I could not find the codes described in Chapter 2. Is the new version named differently?
Thank you!

Jerome Degallaix

Dear premjith t,

Could you send me an email with the code you try to run ? I should be able to find OSCAR V1 if you really need it (however, I do not recommend to use it).


premjith t

Dear Jerome

When i am running class E_field i am getting error
Error in ==> E_Field.E_Field>E_Field.E_Field at 63

Also if there is no mode entered i am getting errors

premjith t

Hi Jerome
Can you please upload an older version OSCAR V1.

Fedor Kiselev

Jerome Degallaix

Hi Peter,
OSCAR V1 is included under OSCAR V3, the presentation has changed to make it more robust but the internal motor is still the same.
Everything which can be done with OSCAR V1 can also be done with the V3 (and of course much more).
I should still be able to find the V1 if you really need it.


Hey Jerome, thanks for the awesome code!
Part 1 of the manual deals with OSCAR V1. Do I understand correctly that none of the files discussed in that important section are part of the download here? where can I get them?

Jerome Degallaix

OSCAR can simulate linear cavities with an arbitrary number of mirrors. See the file: 'Example_4mirrors.m' for example.


Habib (view profile)

do the OSCAr is useful for another cavity such as ring cavity with three element?

Jerome Degallaix

Likely a wrong installation.


Habib (view profile)

Hi guys.
I want simulate a ring cavity that have three mirror. but when I tried to simulation, I got error again and again. How can I do it by OSCAR? pleas help me.
I can't define a LG beam...

Jerome Degallaix

Cavity with a length of few centimeter must work (with a suitable grid side). Send me by email an example for your file so I can fix it.

seongwoo oh

does anybody know why the simulation doesnt work if you make the cavity length small in the range of a few centimeters?

the code doesnt crash but it doesnt plot anything..


I have been using this code since a long time, and I really like it. It is easy to use, and most important, easy to customize for many different purposes.

The documentation is clear and well written, and it's the very first paper to be read to easily understand the basic principles of FFT optical codes.

Moreover, Oscar is constantly updated, and the author is always available and responds quickly to any questions.

Very good job!


Nitin (view profile)

Really nice job.
Documentation is easy to understand and to follow.

Thanks to the author!

Richard Day

This is a first class job.
I have used Oscar as a foundation for my own code for simulating cavities. It is really very easy to understand the code and there is also a very well written user manual.



Update to keep OSCAR compatible with the newest versions of Matlab.
New functions and examples also available


Implementation of the Zernike polynomials
Small improvement to some functions and a handful of bug fixes


New functions and bug fixes


It includes now the function to read the .dat from the ZYGO interferometer.
New functions (plot PSD, expand into higher order modes) and the usual bug fixes


An accelerated convergence scheme has been implemented as well as the possibility to use strong focusing telescope.
Additional minor improvement to existing functions


Bug fixes


Can use a more reliable to propagate the beam and add a new routine to calculate cavity eigen modes.


Can simulate linear cavity with arbitraty number of mirrors. New syntax to define laser beam and Interfaces. Minor bug correction.


The code has been fully rewritten (with Oriented Object Programming) to be faster and more user friendly.
Higher order optical modes are supported.


Example to reduce the computational time of OSCAR, better memory allocation of matrices and correct a sign error


Add an example about how to simulate a 3 mirrors ring cavity (also called a mode cleaner).

Added a new example

A little mistake found in the manual

MATLAB Release
MATLAB 8.6 (R2015b)

MATLAB Online Live Editor Challenge

Win cash prizes and have your live script featured on our website

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video