File Exchange

image thumbnail


version (3.56 MB) by Jerome Degallaix
An optical FFT code to simulate Fabry Perot cavities with arbitrary mirror profiles


Updated 16 Aug 2019

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.

Cite As

Degallaix, J. "OSCAR a Matlab based optical FFT code." Journal of Physics: Conference Series. Vol. 228. No. 1. IOP Publishing, 2010.

Comments and Ratings (25)

Wonderful code and documentation, not only completely usable from the get go but also doubles as a complete introduction / refresher to fourier optics in a hands-on manner thanks to the documentation.
Thank you for sharing!

Guo Hui

Hi Ydy,

Yes, you can do that but for more details please contact me directly.




Dear Jerome,
I want simulate a linear cavity with the minimum waist of 100 um, can I do it with OSCAR?

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!

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.

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?

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


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

Likely a wrong installation.


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...

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!


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.


- New cavity simulations: linear ring cavity
- create virtual maps from 1D PSD
- new options for several functions based on user application
- bug fixes

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).

New version, add an example how to create sidebands and derive a Pound Drever Hall locking signal.

Added a new example

A little mistake found in the manual

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux