clc;
close all;
clear all;
% Parameters
tau = linspace(-10, 10, 1000); % Time delay (in arbitrary units)
omega_0 = 2*pi; % Angular frequency for monochromatic light
delta_omega_LED = 2*pi*1e6; % Linewidth for LED (assumed)
tau_c_thermal = 0.5; % Coherence time for thermal lamp (assumed)
% Autocorrelation functions
g_monochromatic = exp(1i*omega_0*tau);
g_thermal = exp(-abs(tau)/tau_c_thermal);
g_LED = exp(-abs(delta_omega_LED*tau/2)) .* exp(1i*omega_0*tau);
% Plotting
figure;
subplot(2,2,1);
plot(tau, real(g_monochromatic), 'b', 'LineWidth', 1.5);
title('Perfect Monochromatic Source');
xlabel('\tau');
ylabel('Re[g^{(1)}(\tau)]');
subplot(2,2,2);
plot(tau, real(g_thermal), 'r', 'LineWidth', 1.5);
title('Thermal Lamp');
xlabel('\tau');
ylabel('Re[g^{(1)}(\tau)]');
subplot(2,2,3);
plot(tau, real(g_LED), 'g', 'LineWidth', 1.5);
title('Light Emitting Diode (LED)');
xlabel('\tau');
ylabel('Re[g^{(1)}(\tau)]');
subplot(2,2,4);
plot(tau, abs(g_LED), 'm', 'LineWidth', 1.5);
title('Laser Source (Coherence Length 1 km)');
xlabel('\tau');
ylabel('|g^{(1)}(\tau)|');
sgtitle('First-Order Autocorrelation Functions for Different Light Sources');
I was using this code but not getting the correct graph.Using these formulae