how can i plot the Fresnel reflectivities and/or absorptivities ?
7 views (last 30 days)
Show older comments
hi
i have this code but there is problem :
function fresnelplot(n1,n2,k2,plotopt)
%
% fresnelplot(n1,n2,k2,plotopt)
%
% plots the Fresnel reflectivities and/or absorptivities (s-pol, p-pol
% and circ.) for light incident from a dielectric medium with
% refractive index n1 on an opaque absorbing medium with complex refractive
% index n2+i*k2.
%
% Input: n1 - refractive index (medium 1)
% n2 - refractive index (medium 2)
% k2 - extinction coefficient (medium 2)
% plotopt - plotting option (type 'R' for plotting reflectivity,
% 'A' for absorptivity or 'RA' for both)
%
% Output: plots of reflectivities and/or absorptivities
%
% Last updated: 2011-10-26 (David Bergström)
%
thetadeg = (0:0.1:90);
theta = thetadeg*pi/180;
[a,b,c] = intrc(n1,n2,k2,theta);
if nargin<4 || isempty(plotopt)
fprintf('No plotting option specified. Type \''help fresnelplot\'' for further details.\n');
return;
end;
if nargin==4
if ischar(plotopt)
switch plotopt
case {'R','r'}
plot(thetadeg,a,thetadeg,b,thetadeg,c)
legend('Rs','Rp','R','Location','northwest');
xlabel('Angle of incidence \theta');
ylabel('Reflectivity');
case {'A','a'}
plot(thetadeg,1-a,thetadeg,1-b,thetadeg,1-c)
legend('As','Ap','A','Location','northwest');
xlabel('Angle of incidence \theta');
ylabel('Absorptivity');
case {'RA','ra','AR','ar'}
subplot(2,1,1)
plot(thetadeg,a,thetadeg,b,thetadeg,c)
legend('Rs','Rp','R','Location','northwest');
xlabel('Angle of incidence \theta');
ylabel('Reflectivity');
subplot(2,1,2)
plot(thetadeg,1-a,thetadeg,1-b,thetadeg,1-c)
legend('As','Ap','A','Location','northwest');
xlabel('Angle of incidence \theta');
ylabel('Absorptivity');
otherwise
fprintf('%s is not a valid option. Type \''help fresnelplot\'' for further details.\n',plotopt);
end;
else fprintf('Option must be a string. Type \''help fresnelplot\'' for further details.\n');
end;
end;
he says :
plotopt - plotting option (type 'R' for plotting reflectivity,
% 'A' for absorptivity or 'RA' for both)
%
but i don't know how can i define this in matlab ?
2 Comments
Nelson Assis
on 16 Dec 2022
Hello.
You have to calculate the coefficients before you plot the results.
There is other part of code that you have to implement.
Mr. David Bergström made it and share in the link: http://www.mysimlabs.com/auxiliary.html.
Try to implement this code in oop design for time performance.
Answers (0)
See Also
Categories
Find more on Partial Differential Equation Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!