0% found this document useful (0 votes)
6 views

Beatlengthsimulation

WFRFB

Uploaded by

Nayan patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Beatlengthsimulation

WFRFB

Uploaded by

Nayan patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

% User inputs

lambda_nm = input('Enter operating wavelength (nm): '); % Operating wavelength (nm)


coupling_ratio = input('Enter desired coupling ratio (e.g., 0.5 for 50/50): '); % Coupling ratio

% Convert wavelength to meters


lambda = lambda_nm * 1e-9;

% Parameters (assuming fibers are identical)


n_core = 1.45; % Refractive index of core
n_cladding = 1.44; % Refractive index of cladding
core_diameter = 8e-6; % Core diameter (m)
d = 10e-6; % Distance between the two cores (m)

% difference in refractive indices


delta_n = n_core - n_cladding; % Difference in refractive indices

% Coupling coefficient calculation


kappa = (pi / lambda) * sqrt(delta_n) * exp(-pi * d / (2 * core_diameter));

% Beat length in micrometers (µm)


beat_length_um = lambda / delta_n * 1e6;

% Display inputs
fprintf('\nInput Parameters:\n');
fprintf('Operating Wavelength: %d nm\n', lambda_nm);
fprintf('Desired Coupling Ratio: %.2f\n', coupling_ratio);
fprintf('Beat Length: %.3f µm\n\n', beat_length_um);

% Interaction length range for plotting


L_range = linspace(0, 2*pi / kappa, 1000); % Interaction length range (m)

% Convert interaction length range to micrometers (µm)


L_range_um = L_range * 1e6;

% Assuming a sinusoidal variation


coupling_ratio_range = coupling_ratio + (0.5 - coupling_ratio) * cos(2 * kappa * L_range);

% Plot coupling ratio vs interaction length


figure;
plot(L_range_um, coupling_ratio_range, 'k-', 'LineWidth', 1.5);
xlabel('Interaction Length (µm)');
ylabel('Coupling Ratio');
title('Coupling Ratio vs Interaction Length');
grid on;
xlim([0, max(L_range_um)]);
ylim([0, 1]);
xticks(linspace(0, max(L_range_um), 5)); % Set 5 ticks on x-axis
yticks(linspace(0, 1, 5)); % Set 5 ticks on y-axis
% Add vertical lines for beat length intervals
num_intervals = floor(max(L_range_um) / beat_length_um);
for i = 1:num_intervals
xline(i * beat_length_um, 'r--', 'LineWidth', 1.5);
end

% Add a horizontal line at the desired coupling ratio for reference


yline(coupling_ratio, 'b--', 'LineWidth', 1.5);

legend('Coupling Ratio', 'Beat Length Interval', 'Desired Coupling Ratio');


hold off;

You might also like