function varargout = michelson_GUI(varargin)
% MICHELSON_GUI MATLAB code for michelson_GUI.fig
% MICHELSON_GUI, by itself, creates a new MICHELSON_GUI or raises the existing
% singleton*.
%
% H = MICHELSON_GUI returns the handle to a new MICHELSON_GUI or the handle to
% the existing singleton*.
%
% MICHELSON_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MICHELSON_GUI.M with the given input arguments.
%
% MICHELSON_GUI('Property','Value',...) creates a new MICHELSON_GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before michelson_GUI_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to michelson_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 michelson_GUI
% L
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @michelson_GUI_OpeningFcn, ...
'gui_OutputFcn', @michelson_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 michelson_GUI is made visible.
function michelson_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 michelson_GUI (see VARARGIN)
% Choose default command line output for michelson_GUI
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes michelson_GUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = michelson_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;
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
global lambda;
lambda = str2double(get(hObject, 'String'))*10^(-9);
% --- 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
global l;
l = str2double(get(hObject, 'String'));
% --- 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
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (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 edit3 as text
% str2double(get(hObject,'String')) returns contents of edit3 as a double
global D;
D = str2double(get(hObject, 'String'))*10^(-3);
% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (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
% --- 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)
intensity0 = 1;
global D;
global l;
global lambda;
global beta;
global x;
global y;
global r;
xv = -0.1:0.001:0.1;
yv = -0.1:0.001:0.1;
[x, y] = meshgrid(xv, yv);
r = sqrt(x.^2 + y.^2);
beta = 0;
d2 = 0.5;
d1 = (d2-D)*cos(beta);
d = d2-d1*cos(beta);
path1 = sqrt(x.^2 + y.^2+l^2);
path2 = sqrt((x-2*d1*sin(beta)).^2 + y.^2 + (l-2*d)^2);
opticalPath = abs(path1-path2);
sigma = 2 * pi() * opticalPath / lambda;
intensity = 4 * intensity0 * (cos(sigma / 2)).^2;
fig = surf(handles.axes3, x, y, intensity);
set(fig, 'edgecolor', 'none');
view(2);
caxis([0,4]);
colormap(gray);
% --- Executes during object creation, after setting all properties.
function axes3_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes3 (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 axes3
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
intensity0 = 1;
global D;
global l;
global lambda;
global D_step;
global beta;
global x;
global y;
D = D + D_step;
d2 = 0.5;
d1 = (d2-D)*cos(beta);
d = d2-d1*cos(beta);
path1 = sqrt(x.^2 + y.^2+l^2);
path2 = sqrt((x-2*d1*sin(beta)).^2 + y.^2 + (l-2*d)^2);
opticalPath = abs(path1-path2);
sigma = 2 * pi() * opticalPath / lambda;
intensity = 4 * intensity0 * (cos(sigma / 2)).^2;
fig = surf(handles.axes3, x, y, intensity);
set(fig, 'edgecolor', 'none');
view(2);
caxis([0,4]);
colormap(gray);
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserve
Matlab领域
- 粉丝: 3w+
- 资源: 3183
最新资源
- 点云数据处理与开发基础教程
- (源码)基于 JavaWeb 的超市收银系统.zip
- (源码)基于Vue和Cordova的移动端在线选座购票系统.zip
- (源码)基于C++的simpleDB数据库管理系统.zip
- (源码)基于Arduino的RTOSMMESGU实时操作系统项目.zip
- (源码)基于STM32和TensorFlow Lite框架的微语音识别系统.zip
- (源码)基于C#的支付系统集成SDK.zip
- (源码)基于Spring Cloud和Spring Boot的微服务架构管理系统.zip
- (源码)基于物联网的自动化开门控制系统 iotsaDoorOpener.zip
- (源码)基于ROS的Buddy Robot舞蹈控制系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈