What is the difference between unwrap() function and principal value in finding the unwrapped phase?
32 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ansam Osamah
el 10 de Jul. de 2021
Comentada: Ansam Osamah
el 12 de Jul. de 2021
I am working on DFT, and trying to reconstruct the image again from the magnitude and phase. I use two different ways to perform phase unwrapping:
- by using unwrap() Matlab function.
- by using the principal value of phase according to the following:
I found that:
- there is a difference in the unwrapped phase in each of the two methods. However, the reconstructed image was the same (the same PSNR) in both cases.
- the time of phase unwrapping by using principal value was significantly shorter than unwrap() Matlab function.
I'd appreciate it if someone could clarify the reason behind that.
0 comentarios
Respuesta aceptada
David Goodmanson
el 11 de Jul. de 2021
Editada: David Goodmanson
el 11 de Jul. de 2021
Hi Ansam,
The atan2 function does not unwrap anything. It merely produces a four-quadrant theta, with
-pi < theta <= pi.
Consider an initial theta that runs from, say, 0 to 40*pi. The following demo code shows that as a function of theta, the output of atan2 is always between -pi and pi and produces a sawtooth-like result with jumps from -pi to pi. Applying unwrap removes the jumps and produces a continuuous angle so that theta2 runs from 0 to 40*pi and theta2 = theta.
If you plug angles into any trig function there is always the 2pi ambiguity, so theta and theta +- 2*pi*n give the same result. Therefore the unwrapped and not-unwrapped angles give the same result when pluggid into any trig function.
theta = 0:.01:40*pi
y = sin(theta);
x = cos(theta);
theta1 = atan2(y,x);
theta2 = unwrap(atan2(y,x));
plot(theta,theta1,theta,theta2)
Más respuestas (0)
Ver también
Categorías
Más información sobre Multirate Signal Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!