how to draw a 3d surface of exp(x+iy)

4 visualizaciones (últimos 30 días)
Lvfan LIU
Lvfan LIU el 11 de Sept. de 2019
Comentada: Rik el 11 de Sept. de 2019
exp(z)=exp(x)*(cosy+i*siny)
  2 comentarios
Fabio Freschi
Fabio Freschi el 11 de Sept. de 2019
The result is a complex number: what do you want on the axes?
x,y,abs(exp(z))
x,y,real(exp(z))
x,y,imag(exp(z))
Rik
Rik el 11 de Sept. de 2019
z_val=@(x,y) log(exp(x).*(cos(y)+1i*sin(y)));
[X,Y]=ndgrid(linspace(-3*pi,3*pi,100));
Z=z_val(X,Y);
figure
ax1=subplot(1,2,1);
surf(X,Y,real(Z));
title('real part')
ax2=subplot(1,2,2);
surf(X,Y,imag(Z));
title('imaginary part')
Then you can link the axes with linkprop.

Iniciar sesión para comentar.

Respuestas (2)

Bjorn Gustavsson
Bjorn Gustavsson el 11 de Sept. de 2019
Editada: Bjorn Gustavsson el 11 de Sept. de 2019
Have a look at the dcolor submission to the file exchange. That should give you a good starting point for doing this.
There are all sorts of combinations to try to convey the complex-valued surface. You could put the angle as the colour for your surface and the magnitude as the z-value to the plain surf call
[x,y] = meshgrid(linspace(-2,2,1001));
z = log(exp(x).*(cos(y)+i*sin(y)));
surf(x,y,abs(z),angle(z)),shading flat
, or the other way around, or the real and imaginary parts. When it comes to this type of plotting the best way is to try all sort of combinations you can imagine and see which works best for your purposes.
HTH

Fabio Freschi
Fabio Freschi el 11 de Sept. de 2019
Suppose that you want to plot the magnitude of the exp(z)
% setup the range of your plot in x and y (-2,2) and the resolution (20 points)
x = linspace(-2,2,20);
y = linspace(-2,2,20);
% create a regular grid (X and Y are 2d matrices)
[X,Y] = meshgrid(x,y);
% evaluate your function (note that the imaginary unit is 1i, note also the operator .*)
expZ = exp(X).*(cos(Y)+1i*sin(Y))
% now the plot (here the abs, use real or imag as you like)
figure
surf(X,Y,abs(expZ));
% label as desired
xlabel('x coordinate');
ylabel('y coordinate');
zlabel('exp(Z)');

Categorías

Más información sobre Axes Appearance en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by