############################################### # scriptfile: usr_surface_3d_2.lsf # # description: This file creates a surface text # file for an import primitive. This file # creates a matrix with x and y reversed # because the x increases along the rows # and y along the columns. It should be # imported with the "invert x and y axis" # button selected. # # Copyright 2007, Lumerical Solutions, Inc. ############################################### # generate a surface nx = 50; ny = 40; x = linspace(-6,6,nx); y = linspace(-5,5,ny); X = meshgridx(x,y); Y = meshgridy(x,y); Z = exp(-(X^2+Y^2)/4^2) * sin(pi*Y/2); # choose a filename and delete file if it exists filename = "usr_surface_3d_2.txt"; rm(filename); # write the data to file write(filename,num2str(Z));