When we plot z = f(x), where x and z are complex numbers, we get 4 dimensions to plot, so I shifted each point in the surface plot N units + or - in the Y direction, where N is the imaginary part of the output. The color also indicates how far each point was stretched in the + or - Y direction.
#!/usr/bin/octave
global a = 1
global b = 0
global c = 0
function z = polynomial (i,j)
global a
global b
global c
x = i + (j * 1j);
z = a*x*x + b*x + c;
end
[I,J] = meshgrid(-1:0.2:1);
REAL = arrayfun(@real, arrayfun(@polynomial, I, J));
IMAG = arrayfun(@imag, arrayfun(@polynomial, I, J));
vtk_surf(I,J+IMAG,REAL, IMAG);
input ("Orient it the way you want it before I save.");
vtk_print('polynomial.jpg', '-djpeg');
input ("Done!");

2 comments:
:o
.
.
That is *so* cool!
That looks nice, but Octaviz seems to have gone obsolete. I'm trying to reproduce this in Mathematica or Sage or similar software.
Also a question: that plot does not look like a simple (real) quadratic function. Can you explain what are the coordinates and colors?
Post a Comment