function visualizeSpace2D(Transf) % Ensure that x and y are vectors (1D) and create a 2D mesh grid from them [X, Y] = meshgrid(Transf.x, Transf.y); % Create 2D mesh grid from x and y vectors height = 20; width = 45; figure(1) clf set(gcf, 'Units', 'centimeters') set(gcf, 'Position', [2 4 width height]) set(gcf, 'PaperPositionMode', 'auto') % Plot real space grid subplot(1,2,1) hold on % Plot the grid lines for i = 1:size(X, 1) plot(X(i,:), Y(i,:), 'k'); % Plot horizontal grid lines in black end for j = 1:size(X, 2) plot(X(:,j), Y(:,j), 'k'); % Plot vertical grid lines in black end axis equal % Ensures equal scaling for both axes % Set axes labels xlabel(gca, {'$x / l_o$'}, ... 'Interpreter', 'latex', ... 'FontName', 'Times New Roman', ... 'FontSize', 14, ... 'FontWeight', 'normal', ... 'FontAngle', 'normal') ylabel(gca, {'$y / l_o$'}, ... 'Interpreter', 'latex', ... 'FontName', 'Times New Roman', ... 'FontSize', 14, ... 'FontWeight', 'normal', ... 'FontAngle', 'normal') title(gca, 'Real Space', ... 'Interpreter', 'tex', ... 'FontName', 'Times New Roman', ... 'FontSize', 14, ... 'FontWeight', 'normal', ... 'FontAngle', 'normal') % Plot Fourier space grid in a similar style [KX, KY] = meshgrid(Transf.kx, Transf.ky); % Create 2D mesh grid from kx and ky subplot(1,2,2) hold on % Plot the grid lines for i = 1:size(KX, 1) plot(KX(i,:), KY(i,:), 'k'); % Plot horizontal grid lines end for j = 1:size(KX, 2) plot(KX(:,j), KY(:,j), 'k'); % Plot vertical grid lines end axis equal % Ensure equal scaling for both axes % Set axes labels xlabel(gca, {'$k_x / l_o$'}, ... 'Interpreter', 'latex', ... 'FontName', 'Times New Roman', ... 'FontSize', 14, ... 'FontWeight', 'normal', ... 'FontAngle', 'normal') ylabel(gca, {'$k_y / l_o$'}, ... 'Interpreter', 'latex', ... 'FontName', 'Times New Roman', ... 'FontSize', 14, ... 'FontWeight', 'normal', ... 'FontAngle', 'normal') title(gca, 'Fourier Space', ... 'Interpreter', 'tex', ... 'FontName', 'Times New Roman', ... 'FontSize', 14, ... 'FontWeight', 'normal', ... 'FontAngle', 'normal') end