Phase and amplitude hue plot

Plots a complex 2D array. The phase is shown as hue and the amplitude as brightness.
903 Downloads
Updated 7 Jun 2010

View License

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
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.2.0.0

Added an example in the description.
Fixed a bug occurring when plotting the scale.

1.0.0.0