How to determine phase shift
    5 views (last 30 days)
  
       Show older comments
    
    Kabit Kishore
 on 27 Oct 2021
  
    
    
    
    
    Answered: Star Strider
      
      
 on 27 Oct 2021
            I have obtained phases (In degrees) for two different material at different frequences. How do i calculate the phase shift between the two. I have attached the data. Initially i just subtracted the two values but i think that approach is wrong. Any help will be appreciated. 
Kind regards
0 Comments
Accepted Answer
  Star Strider
      
      
 on 27 Oct 2021
        Subtracting them is likely appropriate, however unwrapping them first will likely produce the correct result.  
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/780738/DATA.xlsx', 'VariableNamingRule','preserve')
Fv = T1.('Freq(Hz)');
MAT1 = T1.('MAT1(DEG)');
MAT2 = T1.('MAT2(DEG)');
figure
plot(Fv, MAT1,    Fv, MAT2)
grid
MAT1r = deg2rad(MAT1);
MAT1ru = unwrap(MAT1r);
MAT2r = deg2rad(MAT2);
MAT2ru = unwrap(MAT2r);
figure
yyaxis left
plot(Fv, MAT1ru,    Fv, MAT2ru)
ylabel('Unwrapped Phase (rad)')
yyaxis right
plot(Fv, MAT1ru-MAT2ru)
ylabel('Phase Difference (rad)')
grid
legend('MAT_1','MAT_2','Difference', 'Location','best')
xlabel('Frequency (Hz)')
It is necessary to convert them to radians before unwrapping them.  I kept them as radians here, so use the rad2deg fucntion to convert them back to degrees if desired.  
.
0 Comments
More Answers (0)
See Also
Categories
				Find more on Surrogate Optimization in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


