- This topic has 3 replies, 2 voices, and was last updated 8 years, 5 months ago by Taiwo Ambali Abiola.
-
AuthorPosts
-
-
June 28, 2016 at 2:18 am #40836Taiwo Ambali AbiolaParticipant
Hi all,
I would like to know if anyone has an idea of how to find phase difference between two optical signals. I have a design in which I need to monitor the phase difference between two optical signals over certain parameter changes. what Optical components(module) do I need to use. If the only option I have is to use a Matlab component, how do I go about it putting into considerations that I have two optical input signals now. Thanks alot
-
June 28, 2016 at 7:49 pm #40846Karan AhujaSpectator
Hi Taiwo.
I dont think there any such component in optisystem that would give you the phase difference between two two optical signals directly. You may use a Matlab module for doing it. Here is a Matlab code that will help you finding the difference between two optical signals. You may use it for your purpose.
clear all
% set the lag
lag = pi/2;
% amplitude for sinusodial 1
amp_x = 2;
% amplitude for sinusodial 2
amp_y = 4;
% Sampling frequency
Fs = 1024;
% Time vector of 0.5 second
t = 0:1/Fs:0.5*(Fs-1)/Fs;
% number of points
npts = length(t);
% Create a sine wave of 20 Hz.
x = amp_x * (sin(2*pi*t*20) + …
0.25*randn(1,npts)) + 5;
% Create a sine wave of 20 Hz
% with a phase of pi/2.
y = amp_y * (sin(2*pi*t*20 + lag)…
+ 0.25*randn(1,npts));
% remove bias
x = x – mean(x);
y = y – mean(y);
% plot the signal
figure(1)
plot(t,x,t,y);
xlabel(‘Time (s)’);
ylabel(‘Amplitude’);
legend(‘Signal x(t):sin(2*pi*t*20)’,…
‘Signal y(t):sin(2*pi*t*20+lag)’);
% take the FFT
X=fft(x);
Y=fft(y);
% Calculate the numberof unique points
NumUniquePts = ceil((npts+1)/2);
figure(2)
subplot(211);
f = (0:NumUniquePts-1)*Fs/npts;
plot(f,abs(X(1:NumUniquePts)));
title(‘X(f) : Magnitude response’);
ylabel(‘|X(f)|’)
subplot(212)
plot(f,abs(Y(1:NumUniquePts)));
title(‘Y(f) : Magnitude response’)
xlabel(‘Frequency (Hz)’);
ylabel(‘|Y(f)|’)
figure(3)
subplot(211)
plot(f,angle(X(1:NumUniquePts)));
title(‘X(f) : Phase response’);
ylabel(‘Phase (rad)’);
subplot(212)
plot(f,angle(Y(1:NumUniquePts)));
title(‘Y(f) : Phase response’);
xlabel(‘Frequency (Hz)’);
ylabel(‘Phase (rad)’);
% Determine the max value and max point.
% This is where the sinusoidal
% is located. See Figure 2.
[mag_x idx_x] = max(abs(X));
[mag_y idx_y] = max(abs(Y));
% determine the phase difference
% at the maximum point.
px = angle(X(idx_x));
py = angle(Y(idx_y));
phase_lag = py – px
% determine the amplitude scaling
amplitude_ratio = mag_y/mag_xI hope this will help.
Thanks -
June 28, 2016 at 7:52 pm #40847Karan AhujaSpectator
I will further attach some links that are of your use
http://fp.optics.arizona.edu/jcwyant/Short_Courses/SIRA/3-DirectPhaseMeasurementInterferometry.pdf
http://in.mathworks.com/matlabcentral/newsreader/view_thread/167023
http://in.mathworks.com/matlabcentral/answers/91647-how-do-i-calculate-the-amplitude-ratio-and-phase-lag-for-two-sinusoidal-signals-in-matlab
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4541882/The fourth link is important. You can refer to it for the code part.
Thanks
-
June 28, 2016 at 10:58 pm #40858Taiwo Ambali AbiolaParticipant
Thanks a lot Karan. I will try them now
-
-
AuthorPosts
- You must be logged in to reply to this topic.