# How to assign 4*1 matrix element as directly as stokes polarization parameter?

1 view (last 30 days)
DEEPAK KARARWAL on 5 Oct 2022
Edited: Image Analyst on 6 Oct 2022
I want to assign values of Z as S0, S1, S2, S3 ? How do I do it? Is there any command?
Is there any code in MATLAB to plot the Stokes polarization parameter?
% Mullar Matrix analysis
x=0.1
y=0.9
theta=atand(-x/y)
M=[1 0 0 0 ; 0 cosd(2*theta) sind(2*theta) 0 ; 0 -sind(2*theta) cosd(2*theta) 0 ; 0 0 0 1 ]
S= [1 ;1 ; 0; 0]
Z=M*S
S0=1 ,S1=0.97, S2=0.2195 ,S3=0
DoLP=sqrt(S1^2+S2^2)/S0
Degree_of_Pol=sqrt(S1^2+S2^2+S3^2)/S0
Ex=sqrt(0.5.*(S0+S1)) %Major axis
Ey=sqrt(0.5.*(S0-S1)) %minor axis
orientation_angle=0.5*atand(S2./S1) %orientation angle
ellipticity_angle=0.5*asind(S3./S0) %ellipticity angle
alpha=atand(Ey/Ex);
Ellipticity=tand(ellipticity_angle)
phase_diff=atand(S3/S1)
c=(orientation_angle/abs(orientation_angle))
t= -180:0.9:180
x=Ex.*sind(t+phase_diff)
y=c*Ey.*sind(t)
plot(x,y,'-',LineWidth=2),xlabel('2Ex'),ylabel('2Ey'),title('Polarization Ellipse') %,LineWidth=2)
axis equal
axis square
xlim([-1 1])
ylim([-1 1])
grid on
grid minor

Image Analyst on 5 Oct 2022
Not sure what you mean but how about
Z = [S0, S1, S2, S3];
???
##### 2 CommentsShowHide 1 older comment
Image Analyst on 6 Oct 2022
Edited: Image Analyst on 6 Oct 2022
Make your code into a function and call it 4 times:
% Main program:
S0=1 ,S1=0.97, S2=0.2195 ,S3=0
z = [S0, S1, S2, S3];
for k = 1 : numel(z)
results(k) = MullarMatrixAnalysis(z(k));
end
%======================================================================
% Function definition
% Mullar Matrix analysis
function results = MullarMatrixAnalysis(Z)
x=0.1
y=0.9
theta=atand(-x/y)
M=[1 0 0 0 ; 0 cosd(2*theta) sind(2*theta) 0 ; 0 -sind(2*theta) cosd(2*theta) 0 ; 0 0 0 1 ]
% more code......
but I'm not exactly sure what Z is or whether you want to pass in the whole z (all 4 S values) or just one z (only one of the S values). It's really unclear to me how you're using the various z's and S's.

### Categories

Find more on Matrix Indexing in Help Center and File Exchange

R2021b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by