MATLAB: Plotting a complex exponential, exp(i*x), in 3D

3d plotsplot

Hi, I try to plot the complex exponential, exp(i*x), in 3D. As in https://qph.is.quoracdn.net/main-qimg-b7ac15119bfa0a4840084c98da915ed8?convert_to_webp=true. Using plot or fplot, I got the warning "Imaginary parts of complex X and/or Y arguments ignored" and with ezplot: "This function has no real values".
Any suggestions on how to make such a plot in Matlab?
Thanks, Steven

Best Answer

This approximates it:
t = linspace(0, 2.5, 250);
f = exp(2*pi*4/2.5*1i*t);
figure(1)
plot3(t, real(f), imag(f), 'LineWidth',2)
hold on
plot3(t, real(f), zeros(size(t))-1.5)
plot3(t, zeros(size(t))-2, imag(f))
hold off
grid on
axis([-1 3 -2 2 -1.5 1.5])
view([-125 30])
xlabel('Time', 'Rotation',-30)
ylabel('Real Axis', 'Rotation',10)
zlabel('Imag Axis')
If you want to add the labels, see the documetation for the text function.