I am trying to figure out why using exp(i*x) where x is some vector created by linspace is producing different results depending on how many points I have in x.
Here is some example code for what is happening
x = linspace(-.05,.05,50000);
x2 = linspace(-.05,.05,5000);
test1 = exp((-1i*2*pi/2.04e-6*(0-x).^2)/(2*.5));
test2 = exp((-1i*2*pi/2.04e-6*(0-x2).^2)/(2*.5));
The unwrapped phase plots show a clear quadratic phase for the grid that has 50000 points, but the grid with 5000 points has sharp points in it.
It is not merely something with the unwrap/angle functions. For the application I am trying to do (propagating a beam using the Kirchoff Diffraction Integral) it is producing spurious results (see code below). The plotted result is different depending on n = 10000 or n = 3000
n = 3000;
x = linspace(-.05,.05,n);
l = 2.04e-6;
k = 2*pi/l;
d = .5;
q = 0.4960 + 0.4156i;
s = exp(-1i*k*x.^2/(2*q));
prop_field = zeros(1,length(x));
for o = 1:length(x)
It seems to be something to do with my exp(1i*x^2) functions as shown by the phase code above.