Added Gaussian+Modulation code snippets
This commit is contained in:
parent
b204f37068
commit
9c8f4c036c
@ -88,3 +88,112 @@ title('Honeycomb Lattice ansatz for $|\Psi(x,y)|^2$', 'Interpreter', 'latex', 'F
|
|||||||
xlabel('x');
|
xlabel('x');
|
||||||
ylabel('y');
|
ylabel('y');
|
||||||
colormap parula;
|
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');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user