# How to plot the 2d complex function with amplitude and phase

2 visualizzazioni (ultimi 30 giorni)
Qiu Xu il 20 Gen 2022
Modificato: Paul il 20 Feb 2022
I have a 2d complex function as follows
psi=sqrt(x^2+y^2)*exp(-(x^2+y^2)/16)*exp(i*atan2(y,x));
How to realize the following figure by using Matlab?
In this image, the color on the ring presents the changes of phase of the function from small to big.
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Paul il 20 Feb 2022
Modificato: Paul il 20 Feb 2022
The phase of psi is a function of two variables (x and y). How is "changes of phase" defined? Change wrt x holding y constant (del f / del x)? Change wrt y holding x constant (del f / del y)? Something else?

Accedi per commentare.

### Risposte (1)

Hiro Yoshino il 20 Feb 2022
Modificato: Hiro Yoshino il 20 Feb 2022
Run the following code and see if this fits your thought.
meshgrid is a key here.
x=-1:0.01:1;
y=-1:0.01:1;
[X,Y] = meshgrid(x,y);
phi = sqrt(X.^2+Y.^2).*exp(-(X.^2+Y.^2)/16).*exp(1i*atan2(Y,X));
rPhi = real(phi);
iPhi = imag(phi);
phiPhase = angle(phi);
%phiPhaseW = unwrap(phiPhase);
s2 = surf(X,Y,phiPhase,'LineStyle','none');
xlabel('X')
ylabel('Y')
zlabel('phiPhase')
title('X vs. Y vs. phiPhase')
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Particle & Nuclear Physics in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by