Hello,
great question, haven't tackled a physics one for a while. First off, cool that you're working on interferometers, they are fun to work with.
Secondly, if MATLAB is new to you, know that all variables are stored as matrices, so performing the "*" operation is a matrix multiplication operation. To perform a scalar multiplication of a matrix use ".*". Also, MATLAB does store the real and imaginary parts, and we can extract them seperately.
So, let's rock and roll to some code here, I would like to note that this will only help you get started, you may need to modify this for your particular operation. I'm going to write this code for you to compute the matrix in equation 4. This way, you can change the r and t values along with the phase difference.
optical_field_transmission=0.5;
cross_coupling_coefficient=0.5;
phase_angle_one=pi/4;
phase_angle_two=pi/4;
transfer_matrix(1:2,1:2)=zeros();
transfer_matrix(1,1)=((optical_field_transmission.^2)*exp(i*phase_angle_one))...
-((cross_coupling_coefficient.^2)*exp(i*phase_angle_two));
transfer_matrix(2,2)=((optical_field_transmission.^2)*exp(i*phase_angle_two))...
-((cross_coupling_coefficient.^2)*exp(i*phase_angle_one));
transfer_matrix(1,2)=i.*optical_field_transmission.*cross_coupling_coefficient.*...
(exp(i*phase_angle_one)+exp(i*phase_angle_two));
transfer_matrix(2,1)=i.*optical_field_transmission.*cross_coupling_coefficient.*...
(exp(i*phase_angle_one)+exp(i*phase_angle_two));
So, if you want the matrix values for a single set of input parameters, used the above code. Below i'll write the code to plot the whole domain for each of your parameters(you'll need to change the t and r as i don't know their domains). I will also give you some tools to plot them. We are storing the data in a 4 dimension space, and you'll need to bring that down to 2d in order to plot in MATLAB. this means you'll need to choose fixed values for 3 parameters. Please validate the equations below. If i've made an error it is important that you notice it.
n=1;
m=1;
f=1;
d=1;
for ii=1:0.05:pi
for jj=1:0.05:pi
for kk=0.1:0.1:1
for ll=0.1:0.1:1
data_vault_entry_one_one(d,f,n,m)=((kk.^2)*exp(i*ii))-((ll.^2)*exp(i*jj));
data_vault_entry_two_two(d,f,n,m)=((kk.^2)*exp(i*jj))-((ll.^2)*exp(i*ii));
data_vault_entry_one_two(d,f,n,m)=i.*kk.*ll.*(exp(i*ii)+exp(i*jj));
data_vault_entry_two_one(d,f,n,m)=i.*kk.*ll.*(exp(i*ii)+exp(i*jj));
m=m+1;
end
n=n+1;
end
f=f+1;
end
d=d+1;
end
So this will fill up the data vaults for you. Each data vault has the entry for one of the matrix parameters, you now need to choose which matrix entry you want to plot and which parameters you want fixed. Please read through the plot function, it is very elaborate. Here is one example:
plot(data_vault_entry_one_one(:,pi/4,2,3))
plot(data_vault_entry_two_one(pi/2,:,5,6))
Hope this helps get you started, please validate what i've written here
RC