Dispersion plot of frequency vs Bloch wave function, K

조회 수: 7 (최근 30일)
Emma K.
Emma K. 2021년 1월 4일
답변: Gokul Nath S J 2022년 8월 22일
The problem is to plot w(omega) vs K(capital k) using the highlighted equation when beta is equal to zero. I need help with this, thank you in advance.
clear
clc
echo off
n2=2.89; %refractive index in length a
n1=3.38; %refractive index in length b
c=1e8; %volecity of light m/s
a=0.5*1e-6; %length of a in m
b=0.5*1e-6; %length of b in m
TM=(n1/n2)^2;
Cap_lamda=a+b; %period
w=0.0001:0.01:3*pi;
beta=0.0001:0.01:6*pi;
for i=1:length(w)
for j=1:length(beta)
beta=0;
k1(i,j)=sqrt((w(i)*n1/Cap_lamda).^2-(beta(j)/Cap_lamda)^2);
k2(i,j)=sqrt((w(i)*n2/Cap_lamda).^2-(beta(j)/Cap_lamda)^2);
AplusD(i,j)=cos(k2(i,j)*b)*cos(k1(i,j)*a)*2-sin(k2(i,j)*b)*sin(k1(i,j)*a)*(TM^-1*k1(i,j)/k2(i,j)+TM*k2(i,j)/k1(i,j));
K(w,beta)=(1/(Cap_lamda)^2)*(acos(AplusD(i,j)/2));
exp(-1i*K*Cap_lamda)=(1/2)*(AplusD(i,j))+[1 -1]*(((1/2*(AplusD(i,j)))^2)-1)^0.5;
%%M(i,j)=1/2*(AplusD(i,j))+[1 -1]*(((1/2*(AplusB(i,j)))^2)-1)^0.5;
%%M=exp(-1i*K*Cap_lamda);
end;
end;

답변 (1개)

Gokul Nath S J
Gokul Nath S J 2022년 8월 22일
Hi Emma,
The code has an error on the following line. ω(omega) is an array while betaβ is zero.
K(w,beta)=(1/(Cap_lamda)^2)*(acos(AplusD(i,j)/2));
Unrecognized function or variable 'Cap_lamda'.
Matlab does not support zero based indexing. Since ω is an array, you must also make sure that you are assigning an array having the same dimension as that of K.
Thanks
Gokul Nath S J

카테고리

Help CenterFile Exchange에서 Embedded Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by