Plot the normal-incidence reflectance of this bragg reflector from 300 nm to 800 nm, just like lecture, using the thicknesses found in (a), for 2, 4, and 8 periods.

10 ビュー (過去 30 日間)
an example of a Bragg reflector made out of ZnS and MgF2 films. Assume that you want to make a Bragg reflector centered about a free space wavelength of 600 nm. (a) (1 pt) What thicknesses of ZnS and MgF2 do you need to use (I have calcualted these.? (b) (3 pts) Plot the normal-incidence reflectance of this reflector from 300 nm to 800 nm, just like lecture, using the thicknesses found in (a), for 2, 4, and 8 periods. For both (a) and (b), you can use the same refractive indices as given in lecture, and you can ignore dispersion.
Code
clc;
clear all;
close all;
% Wavelength range from 300 nm to 800 nm
wavelengths = linspace(300, 800, 500) * 1e-9; % Convert to meters
% Thicknesses of ZnS and MgF2 layers
d_zns = 68.18e-9; % meters
d_mgf2 = 108.70e-9; % meters
% Number of periods
periods = [2, 4, 8];
% Plot reflectance for different numbers of periods
figure;
hold on;
for n = periods
reflectance = bragg_reflectance(wavelengths, d_zns, d_mgf2, n);
plot(wavelengths * 1e9, reflectance, 'DisplayName', sprintf('%d periods', n));
end
xlabel('Wavelength (nm)');
ylabel('Reflectance');
title('Normal-Incidence Reflectance of Bragg Reflector');
legend('show');
grid on;
% Function definition at the end of the script
function reflectance = bragg_reflectance(wavelengths, d_zns, d_mgf2, n_periods)
% Constants
n_air = 1.0; % Refractive index of air
n_zns = 2.2; % Refractive index of ZnS
n_mgf2 = 1.38; % Refractive index of MgF2
k = 2 * pi ./ wavelengths; % Wavevector
% Initialize reflectance array
reflectance = zeros(size(wavelengths));
for i = 1:length(wavelengths)
% Transfer matrix for ZnS layer
M_zns = [cos(k(i) * n_zns * d_zns), -1i * sin(k(i) * n_zns * d_zns) / n_zns;
-1i * n_zns * sin(k(i) * n_zns * d_zns), cos(k(i) * n_zns * d_zns)];
% Transfer matrix for MgF2 layer
M_mgf2 = [cos(k(i) * n_mgf2 * d_mgf2), -1i * sin(k(i) * n_mgf2 * d_mgf2) / n_mgf2;
-1i * n_mgf2 * sin(k(i) * n_mgf2 * d_mgf2), cos(k(i) * n_mgf2 * d_mgf2)];
% Transfer matrix for entire stack
M_stack = M_mgf2 * M_zns;
for j = 2:n_periods
M_stack = M_stack * (M_mgf2 * M_zns);
end
% Fresnel coefficients
r = (M_stack(1, 1) + M_stack(1, 2) * n_air) / (M_stack(2, 1) + M_stack(2, 2) * n_air);
% Reflectance
reflectance(i) = abs(r)^2;
end
end
I am not able to get the correct output
  1 件のコメント
Jacob Mathew
Jacob Mathew 2024 年 5 月 22 日
After going through your query, I understand that you are not getting the expected plot. However, it is difficult to diagnose why without a reference to what is the expected graph.
The code that you provided runs and plots all 3 periods without error. The reason why they might not be visible is the scale of the plots varying largely. If you plot them individually, you can distinctly see them:

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeTriangulation Representation についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by