Ansys Learning Forum › Forums › Discuss Simulation › Photonics › FDTD crash when plotting figures using script › Reply To: FDTD crash when plotting figures using script
July 22, 2021 at 3:15 pm
vince
Subscriber
I tried your code, it doesn't crash. I also tried "image", it doesn't crash neither.
x = linspace(-20,20, 500)*1e-6;
y = linspace(-20,20, 500)*1e-6;
Gaussian = matrix(length(x),length(y));
for(i=1:length(x)){
for(j=1:length(y)){
Gaussian(i,j) = exp(-((x(i)/sigma)^2)+(y(j)/sigma)^2);
}}
image(x,y,Gaussian);
x = linspace(-20,20, 500)*1e-6;
y = linspace(-20,20, 500)*1e-6;
Gaussian = matrix(length(x),length(y));
for(i=1:length(x)){
for(j=1:length(y)){
Gaussian(i,j) = exp(-((x(i)/sigma)^2)+(y(j)/sigma)^2);
}}
image(x,y,Gaussian);