How to remove the vertical lines of band gaps?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
GULZAR
am 14 Aug. 2023
Beantwortet: GULZAR
am 14 Aug. 2023
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![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1456617/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1456617/image.jpeg)
How to remove the vertical lines(i.e, imaginary or forbidden range of the function) in band gap
0 Kommentare
Akzeptierte Antwort
Sulaymon Eshkabilov
am 14 Aug. 2023
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*')
figure(1)
hold on
plot(-kz,lambda,'r*')
hold off
1 Kommentar
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Data Import and Network Parameters finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!