- #1
error 401
- 19
- 0
error in defined expression for Fresnel equation in MATLAB (urgent please )??
hi
i have code for plotting Fresnel equation but there's something i didn't understand it and gives
error >>(((
plotopt - plotting option (type 'R' for plotting reflectivity,
% 'A' for absorptivity or 'RA' for both)
))))
any body can explain what should i do .. and how can i define (plotopt ) ? thanks in advance !
the total code ((
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;
))
hi
i have code for plotting Fresnel equation but there's something i didn't understand it and gives
error >>(((
plotopt - plotting option (type 'R' for plotting reflectivity,
% 'A' for absorptivity or 'RA' for both)
))))
any body can explain what should i do .. and how can i define (plotopt ) ? thanks in advance !
the total code ((
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;
))