Clear Filters
Clear Filters

calculate the phase difference error between two waves from the Interferometer which has a 90 degrees phase difference

3 views (last 30 days)
I have two waves generated from the output of an Microwave Interferometer.
I = A1*(sin(phi))+ rand(1,npts) + Vdc1;
Q = A2*(sin(phi+(pi/2)+ps))+ rand(1,npts)+ Vdc2;
I want to calculate the ps which is the phase shift error.
The way I calculated it was, first I use some random constant values to generate these waves:
phi = 0:0.2:4*pi;
ps = 0.2;
A1 = 1;
A2 = 1.2;
Vdc1 = 0.1;
Vdc2 = 0.2;
npts = length(phi);
Now, from this wave I want to calculate the the term ps which I beleive is phase shift error between these waves.

Answers (1)

MULI
MULI on 23 May 2024
Hi Sonal,
I understand that you are required to estimate the phase shift errorps between two waves generated from the output of a Microwave Interferometer.
You may follow these steps to estimate ‘ps
  • To Minimize the difference between the I and Q waves, define a function that quantifies this difference.
  • The `fminsearch` function is then used to find the value of ps that minimizes this difference. It iteratively adjusts the value of ps until it finds the one that best aligns the waves.
The below code provides an estimation of the phase shift error (ps) between the two waves by minimizing the difference between I and Q’ waves.
%Given values
phi = 0:0.2:4*pi;
ps = 0.2; % Initial guess for ps
A1 = 1;
A2 = 1.2;
Vdc1 = 0.1;
Vdc2 = 0.2;
npts = length(phi);
% Generate I and Q waves
I = A1*sin(phi) + rand(1, npts) + Vdc1;
Q = A2*sin(phi + (pi/2) + ps) + rand(1, npts) + Vdc2;
% Define function to minimize
fun = @(ps) norm(I - (A1*sin(phi) + Vdc1) - (A2*sin(phi + (pi/2) + ps) + Vdc2));
% Find ps that minimizes the difference between I and Q
estimated_ps = fminsearch(fun, 0); % Starting guess for ps is 0
disp(['Estimated phase shift error (ps): ', num2str(estimated_ps)]);
You may refer this documentation link for more information on ‘fminsearch’ function.

Community Treasure Hunt

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

Start Hunting!