function varargout = yi_gui(varargin)
% YI_GUI MATLAB code for yi_gui.fig
% YI_GUI, by itself, creates a new YI_GUI or raises the existing
% singleton*.
%
% H = YI_GUI returns the handle to a new YI_GUI or the handle to
% the existing singleton*.
%
% YI_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in YI_GUI.M with the given input arguments.
%
% YI_GUI('Property','Value',...) creates a new YI_GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before yi_gui_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to yi_gui_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 yi_gui
% Last Modified by GUIDE v2.5 09-Apr-2021 23:21:02
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @yi_gui_OpeningFcn, ...
'gui_OutputFcn', @yi_gui_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 yi_gui is made visible.
function yi_gui_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 yi_gui (see VARARGIN)
% Choose default command line output for yi_gui
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes yi_gui wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = yi_gui_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 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)
ao = str2num(get(handles.edit1,'String'));
bo = str2num(get(handles.edit2,'String'));
d = 15;
H0 = 1;
f = 9.375*10^9;
t = 0;
% t=0:1:2 ;
% 计算数据并显示
%d 采样精度
%t t时刻的场结构图
a=ao/1000;
b=bo/1000;
lc=2*a; %TE10截止频率
l0=(3*10^8)/f;
u=4*pi*10^(-7);
if(l0>lc)
return;
else
lg=l0/((1-(l0/lc)^2)^0.5);
c=lg;
B=2*pi/lg;
w=2*pi*(3*10^8);
x=0:a/d:a;
y=0:b/d:b;
z=0:c/d:c;
%电场
[x1,y1,z1]=meshgrid(x,y,z);
ex=zeros(size(x1));
ey=w.*u.*a.*H0.*sin(pi./a.*x1).*sin(w*t-B.*z1)./pi;
ez=ex;
subplot(handles.axes1);
quiver3(z1,x1,y1,ez,ex,ey);
hold on;
%磁场
x2=x1-0.001;
y2=y1-0.001;
z2=z1-0.001;
hx=B.*a.*H0.*sin(pi./a.*x1).*(-sin(w*t-B.*z1))./pi;
hy=zeros(size(y2));
hz=H0.*cos(pi./a.*x1).*cos(w*t-B.*z1);
subplot(handles.axes1);
quiver3(z2,x2,y2,hz,hx,hy,'r');
title('波导管内电磁场分布图')
axis equal
xlabel('传输方向');
ylabel('波导宽边a');
zlabel('波导窄边b');
hold off;
end
% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes1
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (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 edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (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 edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
- 1
- 2
前往页