Calculations/Estimations/VisualizeCosineModulatedAnsatz.m

295 lines
7.1 KiB
Matlab

%% STRIPES
% 2-D
% Parameters
c = 1; % Fourier coeffecient
k = 2; % wavenumber
n = 2; % order
% Range for x and y
x = linspace(-2, 2, 500);
y = linspace(-2, 2, 500);
% Create a meshgrid for 2D
[~, Y] = meshgrid(x, y);
% Define the 2D function
f_xy = (1 + (c * cos(n * k * Y))) / (1 + (0.5 * c^2));
% Plot the 2D image using imagesc
figure(1);
imagesc(x, y, f_xy);
axis xy; % Make sure the y-axis is oriented correctly
colorbar;
xlabel('$x l_o$', 'Interpreter', 'latex', 'FontSize', 14)
ylabel('$y l_o$', 'Interpreter', 'latex', 'FontSize', 14)
title('Stripe Lattice ansatz for $|\Psi(x,y)|^2$', 'Interpreter', 'latex', 'FontSize', 16);
xlabel('x');
ylabel('y');
colormap parula;
%% TRIANGULAR LATTICE
% 2-D
% Parameters
c1 = 0.2;
c2 = 0.2;
k = 3;
n = 1;
% Range for x and y
x = linspace(-2, 2, 500);
y = linspace(-2, 2, 500);
% Create a meshgrid for 2D
[X, Y] = meshgrid(x, y);
% Define the 2D function for a triangular lattice
f_xy = 1 + (c1 * cos(n * k * (2/sqrt(3)) * Y)) + (2 * c2 * cos(n * k * (1/sqrt(3)) * Y) .* cos(n * k * X));
% Plot the 2D image using imagesc
figure(2);
clf
imagesc(x, y, f_xy);
axis xy; % Make sure the y-axis is oriented correctly
colorbar;
xlabel('$x l_o$', 'Interpreter', 'latex', 'FontSize', 14)
ylabel('$y l_o$', 'Interpreter', 'latex', 'FontSize', 14)
title('Triangular Lattice ansatz for $|\Psi(x,y)|^2$', 'Interpreter', 'latex', 'FontSize', 16);
xlabel('x');
ylabel('y');
colormap parula;
%% HONEYCOMB LATTICE
% 2-D
% Parameters
c1 = 0.2;
c2 = 0.2;
k = 3;
n = 1;
% Range for x and y
x = linspace(-2, 2, 500);
y = linspace(-2, 2, 500);
% Create a meshgrid for 2D
[X, Y] = meshgrid(x, y);
% Define the 2D function for a honeycomb lattice
f_xy = 1 - (c1 * cos(n * k * (2/sqrt(3)) * X)) - (2 * c2 * cos(n * k * (1/sqrt(3)) * X) .* cos(n * k * Y));
% Plot the 2D image using imagesc
figure(3);
clf
imagesc(x, y, f_xy);
axis xy; % Make sure the y-axis is oriented correctly
colorbar;
xlabel('$x l_o$', 'Interpreter', 'latex', 'FontSize', 14)
ylabel('$y l_o$', 'Interpreter', 'latex', 'FontSize', 14)
title('Honeycomb Lattice ansatz for $|\Psi(x,y)|^2$', 'Interpreter', 'latex', 'FontSize', 16);
xlabel('x');
ylabel('y');
colormap parula;
%% GAUSSIAN + STRIPES
c = 1; % Fourier coefficient
k = 5 * pi; % Use π to get just a couple of modulations across domain
n = 5;
sigma_y = 0.5; % Narrow along Y to limit rows
sigma_x = 0.3; % Wider along X
% Grid
x = linspace(-2, 2, 500);
y = linspace(-2, 2, 500);
[X, Y] = meshgrid(x, y);
% Gaussian envelope — anisotropic (narrow in y)
G = exp(-((X.^2)/(2*sigma_x^2) + (Y.^2)/(2*sigma_y^2)));
% Modulation function
modulation = (1 + (c * cos(n * k * Y))) / (1 + 0.5 * c^2);
% Combine
f_modulated = G .* modulation;
% Plot
figure(4);
imagesc(x, y, f_modulated);
axis xy; axis equal tight;
colormap('hot');
colorbar;
title('Gaussian + Stripe Modulation');
xlabel('x'); ylabel('y');
%% GAUSSIAN + TRIANGULAR LATTICE
% Parameters
c1 = 0.2;
c2 = 0.2;
k = 5 * pi; % Use π to get just a couple of modulations across domain
n = 5;
sigma_y = 0.5; % Narrow along Y to limit rows
sigma_x = 0.3; % Wider along X
% Grid
x = linspace(-2, 2, 500);
y = linspace(-2, 2, 500);
[X, Y] = meshgrid(x, y);
% Gaussian envelope — anisotropic (narrow in y)
G = exp(-((X.^2)/(2*sigma_x^2) + (Y.^2)/(2*sigma_y^2)));
% Triangular lattice modulation
modulation = 1 + ...
(c1 * cos(n * k * (2/sqrt(3)) * Y)) + ...
(2 * c2 * cos(n * k * (1/sqrt(3)) * Y) .* cos(n * k * X));
% Normalize
modulation = modulation / (1 + c1 + 2*c2);
% Combine with Gaussian
f_modulated = G .* modulation;
% Plot
figure(5);
imagesc(x, y, f_modulated);
axis xy; axis equal tight;
colormap('hot');
colorbar;
title('Gaussian + Triangular lattice');
xlabel('x'); ylabel('y');
%% GAUSSIAN + HONEYCOMB LATTICE
% Parameters
c1 = 0.2;
c2 = 0.2;
k = 5 * pi; % Use π to get just a couple of modulations across domain
n = 5;
sigma_y = 0.5; % Narrow along Y to limit rows
sigma_x = 0.3; % Wider along X
% Grid
x = linspace(-2, 2, 500);
y = linspace(-2, 2, 500);
[X, Y] = meshgrid(x, y);
% Anisotropic Gaussian envelope
G = exp(-((X.^2)/(2*sigma_x^2) + (Y.^2)/(2*sigma_y^2)));
% Honeycomb lattice modulation
modulation = 1 - ...
(c1 * cos(n * k * (2/sqrt(3)) * X)) - ...
(2 * c2 * cos(n * k * (1/sqrt(3)) * X) .* cos(n * k * Y));
% Normalize (optional)
modulation = modulation / (1 + c1 + 2*c2);
% Combine with Gaussian
f_modulated = G .* modulation;
% Plot
figure(6);
imagesc(x, y, f_modulated);
axis xy; axis equal tight;
colormap('hot');
colorbar;
title('Gaussian + Honeycomb lattice');
xlabel('x'); ylabel('y');
%%
% Parameters
A = 1; % Modulation amplitude
p = 2 * pi / 10; % Magnitude of p_j (adjust wavelength)
L = 50; % Spatial extent
N = 500; % Grid resolution
% Coordinate grid
x = linspace(-L, L, N);
y = linspace(-L, L, N);
[X, Y] = meshgrid(x, y);
% Define p_j vectors at 0°, 120°, and 240°
angles = [0, 2*pi/3, 4*pi/3];
P = zeros(size(X));
for j = 1:3
pj = p * [cos(angles(j)); sin(angles(j))]; % 2D vector
dotprod = pj(1) * X + pj(2) * Y;
P = P + cos(dotprod);
end
P = A * P; % Apply modulation amplitude
% Plot
figure(20);
imagesc(x, y, P);
axis equal tight;
colormap turbo; colorbar;
xlabel('$x$', 'Interpreter', 'latex', 'FontSize', 14);
ylabel('$y$', 'Interpreter', 'latex', 'FontSize', 14);
title('Triangle Phase: $P(\mathbf{r}_\perp) = A \sum_{j=1}^3 \cos(\mathbf{p}_j \cdot \mathbf{r}_\perp)$', ...
'Interpreter', 'latex', 'FontSize', 16);
% Parameters
A = -1; % Modulation amplitude
p = 2 * pi / 10; % Magnitude of p_j (adjust wavelength)
L = 50; % Spatial extent
N = 500; % Grid resolution
% Coordinate grid
x = linspace(-L, L, N);
y = linspace(-L, L, N);
[X, Y] = meshgrid(x, y);
r = cat(3, X, Y);
% Define p_j vectors at 0°, 120°, and 240°
angles = [0, 2*pi/3, 4*pi/3];
P = zeros(size(X));
for j = 1:3
pj = p * [cos(angles(j)); sin(angles(j))]; % 2D vector
dotprod = pj(1) * X + pj(2) * Y;
P = P + cos(dotprod);
end
P = A * P; % Apply modulation amplitude
% Plot
figure(21);
imagesc(x, y, P);
axis equal tight;
colormap turbo; colorbar;
xlabel('$x$', 'Interpreter', 'latex', 'FontSize', 14);
ylabel('$y$', 'Interpreter', 'latex', 'FontSize', 14);
title('Honeycomb Phase: $P(\mathbf{r}_\perp) = A \sum_{j=1}^3 \cos(\mathbf{p}_j \cdot \mathbf{r}_\perp)$', ...
'Interpreter', 'latex', 'FontSize', 16);
% Parameters
A = 1;
p = 2 * pi / 10; % Wavevector magnitude
theta = pi/2; % Angle of the wavevector (45° for diagonals)
L = 50;
N = 500;
% Grid
x = linspace(-L, L, N);
y = linspace(-L, L, N);
[X, Y] = meshgrid(x, y);
% Define wavevector p
p_vec = p * [cos(theta); sin(theta)];
% Compute density
P = A * cos(p_vec(1) * X + p_vec(2) * Y);
% Plot
figure(22);
imagesc(x, y, P);
axis equal tight;
colormap turbo; colorbar;
xlabel('$x$', 'Interpreter', 'latex', 'FontSize', 14);
ylabel('$y$', 'Interpreter', 'latex', 'FontSize', 14);
title('Stripe Phase: $P(\mathbf{r}_\perp) = A \cos(\mathbf{p} \cdot \mathbf{r}_\perp)$', ...
'Interpreter', 'latex', 'FontSize', 16);