Why am I not getting the plot results?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Aravind Varma
le 19 Mai 2019
Modifié(e) : madhan ravi
le 19 Mai 2019
c = 3e8;
h = 50e-9;
ramd = 633.0d-9;
omega = 2*pi/ramd*c;
e2 = 1;
enpr = 1.723;
e1 = -11.67345024 + 1i*1.1809292;
theta = 35*pi/180: 0.001 : 45*pi/180;
rpr1 = (cos(theta)/enpr - sqrt((e1-enpr^2*sin(theta).^2)/e1)) / (cos(theta)/enpr + sqrt(e1-enpr^2*sin(theta).^2)/e1);
r12 = (sqrt(e1-enpr^2*sin(theta).^2)/e1 - sqrt(e2-enpr^2*sin(theta).^2)/e2) / (sqrt(e1-enpr^2*sin(theta).^2)/e1 + sqrt(e2-enpr^2*sin(theta).^2)/e2);
alpha = 2*omega/c*h*sqrt(e1-enpr^2*sin(theta).^2)*1i;
R = (rpr1 + r12*exp(alpha))/(1 + rpr1*r12*exp(alpha));
t = theta/pi*180;
plot(t,abs(R));
0 commentaires
Réponse acceptée
madhan ravi
le 19 Mai 2019
Modifié(e) : madhan ravi
le 19 Mai 2019
Because you missed the dot operators: https://in.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html
The below code produces plot as you expect:
c = 3e8;
h = 50e-9;
ramd = 633.0d-9;
omega = 2.*pi/ramd*c;
e2 = 1;
enpr = 1.723;
e1 = -11.67345024 + 1i*1.1809292;
theta = 35*pi/180: 0.001 : 45*pi/180;
rpr1 = (cos(theta)./enpr - sqrt((e1-enpr.^2.*sin(theta).^2)./e1)) ./ (cos(theta)./enpr + sqrt(e1-enpr.^2.*sin(theta).^2)./e1);
r12 = (sqrt(e1-enpr.^2.*sin(theta).^2)./e1 - sqrt(e2-enpr.^2.*sin(theta).^2)./e2) ./ (sqrt(e1-enpr.^2.*sin(theta).^2)./e1 + sqrt(e2-enpr.^2.*sin(theta).^2)./e2);
alpha = 2.*omega./c.*h.*sqrt(e1-enpr.^2.*sin(theta).^2).*1i;
R = (rpr1 + r12.*exp(alpha))./(1 + rpr1.*r12.*exp(alpha));
t = theta./pi*180;
plot(t,abs(R));
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!