A list,

Matlab GUI based Fresnel coefficient calculation: through the plane wave reflection coefficient demonstration, explain the Brewster Angle, show the vertical polarization coefficient and horizontal polarization coefficient amplitude and phase relationship.

Ii. Source code

function varargout = Fresnel(varargin)
% FRESNEL MATLAB code for Fresnel.fig
%      FRESNEL, by itself, creates a new FRESNEL or raises the existing
%      singleton*.
%
%      H = FRESNEL returns the handle to a new FRESNEL or the handle to
%      the existing singleton*.
%
%      FRESNEL('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in FRESNEL.M with the given input arguments.
%
%      FRESNEL('Property'.'Value',...). creates anew FRESNEL or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before Fresnel_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to Fresnel_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one % instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help Fresnel

% Last Modified by GUIDE v2. 5 28-May- 2021. 12:02:27

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @Fresnel_OpeningFcn, ...
                   'gui_OutputFcn',  @Fresnel_OutputFcn, ...
                   'gui_LayoutFcn', [],...'gui_Callback'[]);if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before Fresnel is made visible.
function Fresnel_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to Fresnel (see VARARGIN)

% Choose default command line output for Fresnel
set(handles.uipanel11,'Visible'.'off');
set(handles.uipanel7,'Visible'.'on');
set(handles.uipanel8,'Visible'.'on');
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes Fresnel wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = Fresnel_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in radiobutton_Rs.
function radiobutton_Rs_Callback(hObject, eventdata, handles)
% hObject    handle to radiobutton_Rs (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton_Rs


% --- Executes on button press in radiobutton2.
function radiobutton2_Callback(hObject, eventdata, handles)
% hObject    handle to radiobutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton2


% --- Executes on button press in radiobutton3.
function radiobutton3_Callback(hObject, eventdata, handles)
% hObject    handle to radiobutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton3


% --- Executes on button press in radiobutton4.
function radiobutton4_Callback(hObject, eventdata, handles)
% hObject    handle to radiobutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton4


% --- Executes on button press in radiobutton5.
function radiobutton5_Callback(hObject, eventdata, handles)
% hObject    handle to radiobutton5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton5


% --- Executes on button press in radiobutton6.
function radiobutton6_Callback(hObject, eventdata, handles)
% hObject    handle to radiobutton6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton6


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
n1 = str2double(get(handles.edit_n1,'String'));
n2 = str2double(get(handles.edit_n2,'String'));

if isnan(n1)
    errordlg('Input must be a number'.'Error');
end
if isnan(n2)
    errordlg('Input must be a number'.'Error');
end
Incidence = pi/2; % Incidence Angle range d =0.1*pi/180;
xx = 0:d:Incidence; % Incident Angle % Plot X = xx.*180/pi;

Transmission = asin((n1*sin(xx))./n2); % Transmission Angle [ver,hor] = find((n1*sin(xx))./n2 > 1); % is greater than zero Transmission(VER, HOR) =0; Line_rs = get(handles. Radiobutton_rrs,'Value');
line_rp = get(handles.radiobutton_rp,'Value');
line_ts = get(handles.radiobutton_ts,'Value');
line_tp = get(handles.radiobutton_tp,'Value'); 
line_ps = get(handles.radiobutton_ps,'Value'); 
line_Ts = get(handles.radiobutton_Ts,'Value'); 
line_Tp = get(handles.radiobutton_Tp,'Value');
line_pp = get(handles.radiobutton_pp,'Value');
line_Tn = get(handles.radiobutton_Tn,'Value');
line_pn = get(handles.radiobutton_pn,'Value'); % Calculate the transmittance rs = -sin(xx - Transmission)./sin(xx + Transmission);
ts = 2*sin(Transmission).*cos(xx)./sin(xx + Transmission);
rp = tan(xx - Transmission)./tan(xx + Transmission);
tp = 2*sin(Transmission).*cos(xx)./(sin(xx + Transmission).*cos(xx - Transmission)); % Calculate the reflection ratio ps = rs.*rs; Ts = n2.*cosd(Transmission)./(n1.*cosd(xx)).*ts.*ts; pp = rp.*rp; Tp = n2.*cosd(Transmission)./(n1.*cosd(xx)).*tp.*tp; Popupmenu_model = get(handles. Popupmenu_model,'Value'); %1Is linearly polarized light,2For the natural lightif Model == 1Axes (handles. Axes1);if line_rs == 1
        plot(X,rs,'color'.'r');
        hold on
    end
    if line_ts == 1
        plot(X,ts,'color'.'m');
        hold on
    end
    if line_rp == 1
        plot(X,rp,'color'.'g');
        hold on
    end
    if line_tp == 1 
        plot(X,tp,'color'.'c'); Axes (handles. Axes2)if line_ps == 1
        plot(X,ps,'b');
        hold on
    end
    if line_Ts == 1
        plot(X,Ts,'y');
        hold on
    end
    if line_pp == 1
        plot(X,pp,'r');
    end
    if line_Tp == 1
        plot(X,Tp,'g'); 
    end
    hold off
elseAxes (handles. Axes1); cla reset %set(handles.axes1,'Visible'.'off')
    pn = (ps + pp)./2;
    Tn = 1 - pn;
Copy the code

3. Operation results

Fourth, note

Version: 2014 a