%% Complex-Valued Natural Logarithm
% Create two Cartesian grids for X and Y.

[X,Y] = meshgrid(0:0.5:1.5,-2:0.5:2);

%
% Calculate the complex natural logarithm \ln(X + iY) on the grid. Use 1i for improved speed and robustness with complex arithmetic.

Z = log(X + 1i*Y)

% Copyright 2015 The MathWorks, Inc.