how to draw a 3d surface of exp(x+iy)
5 次查看(过去 30 天)
显示 更早的评论
exp(z)=exp(x)*(cosy+i*siny)
2 个评论
Fabio Freschi
2019-9-11
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
2019-9-11
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.
回答(2 个)
Bjorn Gustavsson
2019-9-11
编辑:Bjorn Gustavsson
2019-9-11
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
0 个评论
Fabio Freschi
2019-9-11
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)');
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Axes Appearance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!