This script plots the polarization Stokes vectors (S1, S2, S3) on a Poincare sphere. See "Polarized Light" by Collett (publ. Dekker) for a background on the optics.
Type "poincare" at the Matlab prompt and a graphical window should pop up. Enter an input data file in the GUI, then lick "Plot". You can also save the output graph to a .jpg file.
The input data file format can be modified to your instrument's output. Currently the format is compatible with the ThorLabs PA-430 Polarimeter. This data file format conforms to that produced by the above polarimeter's data logger application, which is part of the "polar4.exe" software provided for this instrument. This software is running on a Win95 machine with a Keithley DAS-1700 PCI board controlling the polarimeter.
This plot routine uses shading to indicate where on the 3-D surface the
data lies. That is, if the data lies on the back-side of the sphere, then it should be shaded; otherwise it is not shaded. The routine behaves in this manner in the figure window on the screen, however, unfortunately there is a bug regarding this shading algorithm if the figure is printed (directly to a printer) or if the figure is saved to a graphical file. Matlab suggested that this is due to a bug in the OpenGL graphics renderer. They have confirmed this bug in both Matlab 7.1 and Matlab
7.2. So far I have not found a suitable workaround. See the .m code for some comments from Matlab on the problem. If you discover a fix, I would be glad to hear it!
great code，thanks for sharing
The format of ThorLabs PA-430 Polarimeter data is <Time stamp>,<Stokes 0 - 3>,<DOP>,<DOLP>,<DOCP>,<Ellipticity>,<Orientation>\n
You can change other polarimeter data to this format and visulize the poincarre sphere
Use print screen to capture any image you plot then paste into your favorite image editor such as paint to save into .jpg for instance.
Create scripts with code, output, and formatted text in a single executable document.