Phase and amplitude hue plot
This routine was meant to be used as a tool to represent the a complex electric field in a plane (with phase and amplitude)
Usage:
PHPLOT(FIELD)
Plots the phase of a 2D complex array (FIELD) in a continuous color scale (hue) and represents the normalized amplitude as brightness (r+g+b)*amplitude.
PHPLOT(FIELD,AMP,FLAG)
If AMP = 0 the amplitude is not plotted
If FLAG = 1 the function creates a figure with a dial scale (from 0 to 2*pi) and radial brightness (from 0 to one)
A=PHPLOT(...) creates a 3D uint8 array that can be saved as an image with the syntax IMWRITE(A,'filename','fmt').
Example:
[x,y]=meshgrid(-3*pi:0.1:3*pi);
F=sin(x.*y)-x*i;
subplot(1,3,1)
imagesc(abs(F))
subplot(1,3,2)
imagesc(angle(F))
subplot(1,3,3)
phplot(F,1,0);
axis image
Cite As
Iacopo Mochi (2024). Phase and amplitude hue plot (https://www.mathworks.com/matlabcentral/fileexchange/27846-phase-and-amplitude-hue-plot), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.