필터 지우기
필터 지우기

How to remove the vertical lines of band gaps?

조회 수: 2 (최근 30일)
GULZAR
GULZAR 2023년 8월 14일
답변: GULZAR 2023년 8월 14일
clc
close all
c = 3e8;
d1 = 0.4;
d2 = 0.6;
d = d1 + d2;
n1 = sqrt(12);
n2 = 1;
lambda = linspace(400e-3,800e-3, 10000);
D1 = (2*pi*n1*d1)./lambda;
D2 = (2*pi*n2*d2)./lambda;
RHS = cos(D1).*cos(D2) - 0.5*(n1^2+n2^2)/(n1*n2) * sin(D1) .*sin(D2);
kz =acos(RHS)/d;
figure(1)
plot(kz,lambda,'r')
figure(1)
hold on
plot(-kz,lambda,'r')
hold off
How to remove the vertical lines(i.e, imaginary or forbidden range of the function) in band gap

채택된 답변

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 8월 14일
If I understood your question correctly, one of the possible easy solutions is to use logical indexing to remove those data points (vertical data points) from the data to be plotted, e.g.:
clc
close all
c = 3e8;
d1 = 0.4;
d2 = 0.6;
d = d1 + d2;
n1 = sqrt(12);
n2 = 1;
lambda = linspace(400e-3,800e-3, 10000);
D1 = (2*pi*n1*d1)./lambda;
D2 = (2*pi*n2*d2)./lambda;
RHS = cos(D1).*cos(D2) - 0.5*(n1^2+n2^2)/(n1*n2) * sin(D1) .*sin(D2);
kz =acos(RHS)/d;
IDX1 = kz>3.1415;
kz(IDX1)=[];
lambda(IDX1)=[];
figure(1)
plot(kz,lambda,'r*')
Warning: Imaginary parts of complex X and/or Y arguments ignored.
figure(1)
hold on
plot(-kz,lambda,'r*')
Warning: Imaginary parts of complex X and/or Y arguments ignored.
hold off
  댓글 수: 1
GULZAR
GULZAR 2023년 8월 14일
편집: GULZAR 2023년 8월 14일
But, I need to remove the center vertical lines also. The below figure is the plot of RHS vs lamda. From these exclude values([-1,1]) of RHS vs lambda is created the band gap(forbidden range) in kz vs lamda.
You are using the kz>3.1415, i understood. But i need complete band gap (without vertical line).
figure(1)
plot(kz,lambda,'r')
figure(1)
hold on
plot(-kz,lambda,'r')
hold off
figure(1)
hold on
plot(RHS,lambda,'b')
hold off
figure(1)
hold on
plot(-RHS,lambda,'b')
hold off
figure(2)
plot(RHS,lambda,'b')
figure(2)
hold on
plot(-RHS,lambda,'b')
hold off

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

GULZAR
GULZAR 2023년 8월 14일
clc
close all
c = 3e8;
d1 = 0.4;
d2 = 0.6;
d = d1 + d2;
n1 = sqrt(12);
n2 = 1;
lambda = linspace(400e-3,800e-3, 10000000);
D1 = (2*pi*n1*d1)./lambda;
D2 = (2*pi*n2*d2)./lambda;
RHS = cos(D1).*cos(D2) - 0.5*(n1^2+n2^2)/(n1*n2) * sin(D1) .*sin(D2);
kz1 =acos(RHS)/d;
IDX1 = -1<RHS<1;
kz1(IDX1)=nan;
lambda(IDX1)=nan;
kz=real(kz1);
kz(kz==0)=nan;
figure(1)
plot(kz,lambda,'r')
figure(1)
hold on
plot(-kz,lambda,'r')
hold off
This is the required plot. Any other possible.... Please let me know.
Thank you.

카테고리

Help CenterFile Exchange에서 Data Import and Network Parameters에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by