function [xx1,xx2,yy] = ... FourierSerNDimEx1mesh(x1_limits,x2_limits,num_pts_x1_and_x2) % By Neil E. Cotter. % Create mesh plot points for f = sqrt(2)*cos(2*pi*(x1+2*x2)) % % Input: % x1_limits = [x1_min, x1_max] horizontal vector % x2_limits = [x2_min, x2_max] horizontal vector % num_pts_x1_and_x2 = number of points to generate in both % x1 and x2 directions. Gives (num_pts_x1_and_x2)^2 points. % Points are evenly distributed between min and max in each direction. % % Outputs: % xx1 = x1-coordinates (longitude) % xx2 = x2-coordinates (latitude) % yy = y-coordinates (altitude) % Create the x1,x2 pts x1_spacing = (x1_limits(2)-x1_limits(1))/(num_pts_x1_and_x2 - 1) x2_spacing = (x2_limits(2)-x2_limits(1))/(num_pts_x1_and_x2 - 1) x1 = x1_limits(1) : x1_spacing : x1_limits(2); x2 = x2_limits(1) : x2_spacing : x2_limits(2); [xx1,xx2] = meshgrid(x1,x2); % Evaluate function f at every grid point. yy = sqrt(2)*cos(2*pi*(xx1 + 2*xx2)); return