what is the difference between "unwrap" and "phasez" function

12 views (last 30 days)
Hello, I'm trying to analyze the phase response of S-parameter.
And there are 2 functions in Matlab in term of unwrapped phase, which are "unwrap" and "phasez".
When I plot three case below, it shows difference result.
test1 = angle(S21)*180/pi;
test2 = unwrap(angle(S21)*180/pi);
test3 = phasez(angle(S21)*180/pi);
I understood the how the "unwrap" function work. (It just make it flat.)
But, I couldn't get How the matlab create the "phasez" plot. And, I found out the "phasez" function make the matrix size to be 512*1. Is there specific reason for this?
In addition,in principle, the unwrapped phase need to start from 0 in DC.
But, the plot of test2 doesn't. So, that's also confusing.
Is there anyone to explain this question?

Accepted Answer

Rachana Reddy Mamilla
Rachana Reddy Mamilla on 30 Aug 2018
Unwrap function is used to make the phase continuous and it’s not necessary for it to Start from 0.It depends on the input you give. phasez returns the n-point unwrapped phase response vector. If n is not defined ,It would consider the default value to be 512(which is an intermediate value using which one can hopefully get most of the information). If n is not defined , it would consider the default value to be 512 (which is an intermediate value using which one can hopefully get most of the information). For best results, set n to a value greater than the filter order. You can check this for more info.
  1 Comment
Nathan Jessurun
Nathan Jessurun on 10 Dec 2018
Hi Rachana,
The answer you linked no longer exists. Would you mind updating the reference?
Also, I attempted to plot the phase with a greater n than the filter order in this example (https://www.mathworks.com/matlabcentral/answers/435035-how-does-phasez-work) but it didn't make any difference. Do you have any other suggestions?
Thanks!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!