MATLAB: How can i unwrap the phase of the plot

phase unwrapping

Hello Everyone, please can anyone help me with my code? It can be found attached.
After my code is compiled i get a phase vs temperature plot that is continuous while i want to have a sawtooth likewise behaviour at 360 degrees. Basically i want to be unwrapted at 360 degrees and even i tried the unwrap function i didnt get a result Thanks a lot in advance Dimitris

Best Answer

You actually want to wrap it, if I understand you correctly. You can use the mod or rem functions (choose a version) to wrap it:
phs = [0:10:1440]; % ‘Unwrapped’ phase
phwrap = @(adeg) mod(adeg, 360+1E-8); % Wrap Phase (mod)
phwrap = @(adeg) rem(adeg, 360+1E-8); % Wrap Phase (rem)
wphas = phwrap(phs);
figure(1) % Plot The Result
plot(phs, wphas)
grid
If you want to ‘unwrap’ it, use the built-in MATLAB unwrap function.
Related Question