From 9c8f4c036cde6e2b32e780be03da6713980a7a43 Mon Sep 17 00:00:00 2001 From: Karthik Date: Fri, 9 May 2025 00:25:18 +0200 Subject: [PATCH] Added Gaussian+Modulation code snippets --- Estimations/VisualizeCosineModulatedAnsatz.m | 109 +++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/Estimations/VisualizeCosineModulatedAnsatz.m b/Estimations/VisualizeCosineModulatedAnsatz.m index 1787409..f58badb 100644 --- a/Estimations/VisualizeCosineModulatedAnsatz.m +++ b/Estimations/VisualizeCosineModulatedAnsatz.m @@ -88,3 +88,112 @@ title('Honeycomb Lattice ansatz for $|\Psi(x,y)|^2$', 'Interpreter', 'latex', 'F 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'); + + +