Unwrap Phase Angle in a contour plot
6 views (last 30 days)
Show older comments
Hello,
I am trying to plot amplitude and phase angle for stress components in soil for a constant frequency. Everything looks good (Amplitude, Real, and Imaginary part) But when it comes to calculate phase angle, I get unreasonable results due to jumps in phase angle. I know the function "unwrap" would fix this problem when angle is plotted with respect to frequency, but here the frequency is constant and the location (vertical, horizontal) is changing.
I really appreciate any suggestion/guidance. The following code is for plotting phase angle, while I put real, imag, and amplitude figures for reference.
phase angle is calculated as arctan(Imag/Real) and adjusted to have the value of -pi to pi.
clc; clear all; x = load('horizontal.txt'); z = load('vertical.txt');
Phase_shear = load('shearphase.txt');
% use meshgrid to create X and Y mesh
nlin = 100;
xlin = linspace(min(x),max(x),nlin);
zlin = linspace(min(z),max(z),nlin);
[X,Z] = meshgrid(xlin,zlin);
s_s = griddata(x,z,Phase_shear,X,Z);
figure (1) contourf(X,Z,s_s,1000,'linestyle','none'); colorbar; xlabel('x/a') ylabel('z/a') % caxis([0, 2*pi()]) % ylim([0 5]) xlim([0 2.5]) set(gca,'YDir','Reverse') title('\tau_r_z/p Phase Angle (Radians)')
Thank you, Bahar
0 Comments
Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots 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!