help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Plotting functions of complex variable


From: Gonsolo
Subject: Plotting functions of complex variable
Date: Fri, 2 Nov 2012 01:24:09 +0100

After searching the net for over an hour here is a solution for plotting three-dimensional plots of complex variables with Octave. Hopefully it will enter a prominent place in Google searches.

Keywords: Plot, plotting, function, complex number, complex variable.

cat plot_complex.m:

# Easily plotting functions of complex variables with octave

# Establish the complex plane
tx = linspace (-1, 1, 40)';
ty = linspace (-5, 5, 40)';
[xx, yy] = meshgrid (tx, ty);

# Make f a simple complex function
f = xx + i*yy;

# Experiment with various functions
# Note: Always use componentwise operators like .*
#g = f .* f;
g = exp(f);

# Plot the real and imaginary parts of the function
mesh (tx, ty, real(g));
#mesh (tx, ty, imag(g));

--
g


reply via email to

[Prev in Thread] Current Thread [Next in Thread]