📄 capped_wedge_gui.m
字号:
% Hints: get(hObject,'String') returns contents of edit8 as text% str2double(get(hObject,'String')) returns contents of edit8 as a double% --- Executes during object creation, after setting all properties.function edit9_CreateFcn(hObject, eventdata, handles)% hObject handle to edit9 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit9_Callback(hObject, eventdata, handles)% hObject handle to edit9 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit9 as text% str2double(get(hObject,'String')) returns contents of edit9 as a double% --- Executes during object creation, after setting all properties.function edit10_CreateFcn(hObject, eventdata, handles)% hObject handle to edit10 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit10_Callback(hObject, eventdata, handles)% hObject handle to edit10 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit10 as text% str2double(get(hObject,'String')) returns contents of edit10 as a double% --- Executes during object creation, after setting all properties.function edit11_CreateFcn(hObject, eventdata, handles)% hObject handle to edit11 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit11_Callback(hObject, eventdata, handles)% hObject handle to edit11 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit11 as text% str2double(get(hObject,'String')) returns contents of edit11 as a double% --- Executes during object creation, after setting all properties.function edit12_CreateFcn(hObject, eventdata, handles)% hObject handle to edit12 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit12_Callback(hObject, eventdata, handles)% hObject handle to edit12 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit12 as text% str2double(get(hObject,'String')) returns contents of edit12 as a double% --- Executes during object creation, after setting all properties.function edit13_CreateFcn(hObject, eventdata, handles)% hObject handle to edit13 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit13_Callback(hObject, eventdata, handles)% hObject handle to edit13 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit13 as text% str2double(get(hObject,'String')) returns contents of edit13 as a double% --- 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
h2=gcf;
rb3value = get(findobj(h2,'Tag','radiobutton3'),'Value');
if rb3value == 1
CapType = get(findobj(h2,'Tag','radiobutton3'),'String');
set(findobj(h2,'Tag','radiobutton4'),'value',0);
set(findobj(h2,'Tag','radiobutton5'),'value',0);
end% --- 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
h2=gcf;
rb3value = get(findobj(h2,'Tag','radiobutton4'),'Value');
if rb3value == 1
CapType = get(findobj(h2,'Tag','radiobutton4'),'String');
set(findobj(h2,'Tag','radiobutton3'),'value',0);
set(findobj(h2,'Tag','radiobutton5'),'value',0);
end
% --- 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 radiobutton5h2=gcf;
rb3value = get(findobj(h2,'Tag','radiobutton5'),'Value');
if rb3value == 1
CapType = get(findobj(h2,'Tag','radiobutton5'),'String');
set(findobj(h2,'Tag','radiobutton3'),'value',0);
set(findobj(h2,'Tag','radiobutton4'),'value',0);
end
% --- Executes during object creation, after setting all properties.function popupmenu4_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in popupmenu4.function popupmenu4_Callback(hObject, eventdata, handles)% hObject handle to popupmenu4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns popupmenu4 contents as cell array% contents{get(hObject,'Value')} returns selected item from popupmenu4% --- Executes on button press in Plot_Button.function Plot_Button_Callback(hObject, eventdata, handles)% hObject handle to Plot_Button (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
% close (figure(1)); close (figure(2));
% close (figure(3)); close (figure(4));
% close (figure(5)); close (figure(6));
% close (figure(7)); close (figure(8));
img = sqrt(-1);
rtd = 180/pi; dtr = pi/180;
mu0 = 4*pi*1e-7; % Permeability of free space
eps0 = 8.854e-12; % Permittivity of free space
% ===== Input parameters =====
%alphad = 30; % above x Wedge angle
h2=gcf;
set(handles.figure1,'WindowStyle','normal')
alphad = str2num(get(findobj(h2,'Tag','edit5'),'String'));
betad = str2num(get(findobj(h2,'Tag','edit6'),'String'));
ar = str2num(get(findobj(h2,'Tag','edit8'),'String'));
rhop = str2num(get(findobj(h2,'Tag','edit9'),'String'));
phipd = str2num(get(findobj(h2,'Tag','edit10'),'String'));
freq = str2num(get(findobj(h2,'Tag','edit11'),'String'));
epsr = str2num(get(findobj(h2,'Tag','edit12'),'String'));
mur = str2num(get(findobj(h2,'Tag','edit13'),'String'));
Ie = str2num(get(findobj(h2,'Tag','edit14'),'String'));
ax = str2num(get(findobj(h2,'Tag','edit15'),'String'));
by = str2num(get(findobj(h2,'Tag','edit16'),'String'));
nx = str2num(get(findobj(h2,'Tag','edit17'),'String'));
ny = str2num(get(findobj(h2,'Tag','edit18'),'String'));
popm4 = get(findobj(h2,'Tag','popupmenu4'),'Value');
if popm4 == 1
reference = 'on x-axis';
elseif popm4 == 2
reference = 'top face';
elseif popm4 == 3
reference = 'bisector';
end
popm1 = get(findobj(h2,'Tag','popupmenu1'),'Value');
if popm1 == 1
Field = 'Near Field';
elseif popm1 == 2
Field = 'Far Field';
end
rb3value = get(findobj(h2,'Tag','radiobutton3'),'Value');
if rb3value == 1
CapType = get(findobj(h2,'Tag','radiobutton3'),'String');
set(findobj(h2,'Tag','radiobutton4'),'value',0);
set(findobj(h2,'Tag','radiobutton5'),'value',0);
end
rb4value = get(findobj(h2,'Tag','radiobutton4'),'Value');
if rb4value == 1
CapType = get(findobj(h2,'Tag','radiobutton4'),'String');
set(findobj(h2,'Tag','radiobutton3'),'value',0);
set(findobj(h2,'Tag','radiobutton5'),'value',0);
end
rb5value = get(findobj(h2,'Tag','radiobutton5'),'Value');
if rb5value == 1
CapType = get(findobj(h2,'Tag','radiobutton5'),'String');
set(findobj(h2,'Tag','radiobutton3'),'value',0);
set(findobj(h2,'Tag','radiobutton4'),'value',0);
end
engll = get(findobj(h2,'Tag','english'),'Value');
if engll == 1
SourceType = 'Line Source'; % Soutce Type 'Line Source' or 'Plane Wave'
set(findobj(h2,'Tag','si'),'value',0);
end
engl = get(findobj(h2,'Tag','si'),'Value');
if engl == 1
SourceType = 'Plane Wave'; % Soutce Type 'Line Source' or 'Plane Wave'
set(findobj(h2,'Tag','english'),'value',0);
end
% ax = 3*rhop; by = 2*rhop; % area for near field calculations
% nx = 45; ny = 30; % Number of points for near field calculations
% ===== End of Input Data =====
alpha = alphad*dtr;
beta = betad *dtr;
switch reference
case 'top face'
alpha = 0;
vi = pi/(2*pi-beta);
case 'bisector'
beta = alpha;
vi = pi/(2*pi-2*beta);
case 'on x-axis'
vi = pi/(2*pi-alpha-beta);
end
phip = phipd*dtr;
etar = sqrt(mur/epsr);
mu = mu0*mur;
eps = eps0*epsr;
lambda = 2.99e8/freq;
k = 2*pi/lambda; % free space wavenumber
ka = k*ar;
k1 = k*sqrt(mur*epsr); % wavenumber inside dielectric
k1a = k1*ar;
krhop = k*rhop;
omega =2*pi*freq;
switch SourceType
case 'Line Source'
switch Field
case 'Far Field'
% <<< Far field Calculations of Ez component >>>
% Line source excitation
Nc =round(1+2*k*rhop); % number of terms for series summation
Term = pi*omega*mu0/(2*pi-alpha-beta);
Term0D = img*4*pi/(2*pi-alpha-beta);
Term0C = -img*4*pi/(2*pi-alpha-beta);
Term0 = 4*pi/(2*pi-alpha-beta);
for ip = 1:360
phii = (ip -1)*dtr;
xphi(ip) = ip-1;
if phii > alpha & phii < 2*pi-beta % outside the wedge region
EzFLs(ip) = 0;
for m = 1:Nc
v = m*vi;
ssterm = (img^v)*sin(v*(phip-alpha))*sin(v*(phii-alpha));
switch CapType
case 'Dielectric'
Aterm = k * besselj(v,k1a)*(dbesselj(v,ka)*bessely(v,krhop)-dbessely(v,ka)*besselj(v,krhop)) ...
+k1*dbesselj(v,k1a)*( bessely(v,ka)*besselj(v,krhop)- besselj(v,ka)*bessely(v,krhop));
Bterm =k*dbesselh(v,2,ka)*besselj(v,k1a)-k1*besselh(v,2,ka)*dbesselj(v,k1a);
EzLS(m) = Term0D*ssterm*Aterm/Bterm;
case 'Conductor'
Aterm = bessely(v,ka)*besselj(v,krhop)- besselj(v,ka)*bessely(v,krhop);
Bterm = besselh(v,2,ka);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -