Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Digital modulation feature extraction using unwrapped phase

Status
Not open for further replies.

LeonardoHonda

Newbie level 2
Joined
Aug 27, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
Brazil
Activity points
36
I created a BPSK signal in Matlab and I'm wanting to extract the unwrapped phase from the instantaneous phase obtained. The detail is that the result will apply an equation to get the centered non-linear component of the instantaneous phase which is given for "phi_NL" in the code below. This nonlinear phase should be between a value close to zero and pi, which is in accordance with the signal, as occurs in the BPSK phase shift of pi in each transition from 0 to 1 or from 1 to 0, in the encoding to be transmitted.

I've used the function unwrap Matlab, but the nonlinear phase ends infinitely increasing or decreasing. Researched more about the unwrapped phase in the internet and got the function below. However, the same result was obtained earlier. But changing the limits of "difference" to pi/2 and using a sine to create the modulated signal, the result is a phase that varies between zero and Pi, as expected.

I wonder if I can modify this threshold unwrap that way, since I can not get the expected result with the original code. Another thing I would like to know what is the relationship between this threshold with the cosine and sine used in signal modulation of the BPSK signal.

The full paper is in the address below:
https://www.radioeng.cz/fulltexts/2011/11_01_025_030.pdf

Thanks!

____________________________________________________________________________________

ns = 100; % Number of symbols
fs = 100*10^6; % Sample frequency
fc = 10*10^6; % Carrier frequency
rs = 500*10^3; % Symbol rate
nb = fs/rs; % Number of samples per symbol duration
Ts = 1/fs; % Sample interval


% Creating the modulated signal
% -------------------------------------------------
r = rand(ns,1); a = zeros(ns,1); n = zeros(ns*nb,1);

for i=1:ns
if (r(i)<0.5)
a(i) = 0;
else
a(i) = 1;
end
end

ind=0;
for i=1:1:ns
for j=nb*ind+1:nb*ind+nb
n(j) = a(i);
end
ind=ind+1;
end

z = zeros(ns*nb,1); % BPSK signal

for i=1:ns*nb
fase = n(i)*pi;
z(i) = sin(2*pi*fc*i*Ts + fase); % BPSK signal
end
% -------------------------------------------------

x = hilbert(z);
phi = angle(x); % Instantaneous phase
c = zeros(ns*nb,1);

% The linear component of the instantaneous phase
% -------------------------------------------------
for k = 1:ns*nb
c(k) = 2*pi*fc*k/fs;
end
% -------------------------------------------------



% Unwrapped phase function
% -------------------------------------------------
difference = zeros(ns*nb,1);
phi_uw = phi;

for i = 2:ns*nb
difference = phi(i) - phi(i-1);

if difference > pi/2
phi_uw(i:end) = phi_uw(i:end) - 2*pi;
end

if difference < -pi/2
phi_uw(i:end) = phi_uw(i:end) + 2*pi;
end
end
% --------------------------------------------------


% The centered non-linear component of the instantaneous phase
% --------------------------------------------------
phi_NL = phi_uw(1:1000) - c(1:1000);
% --------------------------------------------------


% PLOTS
figure; plot(n(1:1000));
figure; plot(phi_NL);
figure; plot(phi_uw(1:1000));
 

I created a BPSK signal in Matlab and I'm wanting to extract the unwrapped phase from the instantaneous phase obtained. The detail is that the result will apply an equation to get the centered non-linear component of the instantaneous phase which is given for "phi_NL" in the code below. This nonlinear phase should be between a value close to zero and pi, which is in accordance with the signal, as occurs in the BPSK phase shift of pi in each transition from 0 to 1 or from 1 to 0, in the encoding to be transmitted.

I've used the function unwrap Matlab, but the nonlinear phase ends infinitely increasing or decreasing. Researched more about the unwrapped phase in the internet and got the function below. However, the same result was obtained earlier. But changing the limits of "difference" to pi/2 and using a sine to create the modulated signal, the result is a phase that varies between zero and Pi, as expected.

I wonder if I can modify this threshold unwrap that way, since I can not get the expected result with the original code. Another thing I would like to know what is the relationship between this threshold with the cosine and sine used in signal modulation of the BPSK signal.

The full paper is in the address below:
https://www.radioeng.cz/fulltexts/2011/11_01_025_030.pdf

Thanks!

____________________________________________________________________________________

ns = 100; % Number of symbols
fs = 100*10^6; % Sample frequency
fc = 10*10^6; % Carrier frequency
rs = 500*10^3; % Symbol rate
nb = fs/rs; % Number of samples per symbol duration
Ts = 1/fs; % Sample interval


% Creating the modulated signal
% -------------------------------------------------
r = rand(ns,1); a = zeros(ns,1); n = zeros(ns*nb,1);

for i=1:ns
if (r(i)<0.5)
a(i) = 0;
else
a(i) = 1;
end
end

ind=0;
for i=1:1:ns
for j=nb*ind+1:nb*ind+nb
n(j) = a(i);
end
ind=ind+1;
end

z = zeros(ns*nb,1); % BPSK signal

for i=1:ns*nb
fase = n(i)*pi;
z(i) = sin(2*pi*fc*i*Ts + fase); % BPSK signal
end
% -------------------------------------------------

x = hilbert(z);
phi = angle(x); % Instantaneous phase
c = zeros(ns*nb,1);

% The linear component of the instantaneous phase
% -------------------------------------------------
for k = 1:ns*nb
c(k) = 2*pi*fc*k/fs;
end
% -------------------------------------------------



% Unwrapped phase function
% -------------------------------------------------
difference = zeros(ns*nb,1);
phi_uw = phi;

for i = 2:ns*nb
difference = phi(i) - phi(i-1);

if difference > pi/2
phi_uw(i:end) = phi_uw(i:end) - 2*pi;
end

if difference < -pi/2
phi_uw(i:end) = phi_uw(i:end) + 2*pi;
end
end
% --------------------------------------------------


% The centered non-linear component of the instantaneous phase
% --------------------------------------------------
phi_NL = phi_uw(1:1000) - c(1:1000);
% --------------------------------------------------


% PLOTS
figure; plot(n(1:1000));
figure; plot(phi_NL);
figure; plot(phi_uw(1:1000));

Hi,

I would like to know how did you calculate unwrapped phase. Can you explain me that part? I went through it but i din't understand. Kindly explain.

Thanx
 

Thanks you for your interest in helping me.


I found this code for unwrapping phase in this link below. It's better for you understand. However, I want remeber you that I've changed the threshold for the parameter "difference" from pi to pi/2.

**broken link removed**
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top