Phase and amplitude hue plot

Plots a complex 2D array. The phase is shown as hue and the amplitude as brightness.

You are now following this Submission

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 (2026). Phase and amplitude hue plot (https://uk.mathworks.com/matlabcentral/fileexchange/27846-phase-and-amplitude-hue-plot), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.2.0.0

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

1.0.0.0