function varargout = main(varargin)
% MAIN MATLAB code for main.fig
% MAIN, by itself, creates a new MAIN or raises the existing
% singleton*.
%
% H = MAIN returns the handle to a new MAIN or the handle to
% the existing singleton*.
%
% MAIN('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MAIN.M with the given input arguments.
%
% MAIN('Property','Value',...) creates a new MAIN or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before main_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to main_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 main
% Last Modified by GUIDE v2.5 25-Apr-2024 22:19:54
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @main_OpeningFcn, ...
'gui_OutputFcn', @main_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 main is made visible.
function main_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 main (see VARARGIN)
% Choose default command line output for main
handles.output = hObject;
position = get(handles.pushbutton2,'Position');
I = imread('1.png'); %读取图片
I = imresize(I, [position(4)*1 position(1)*1]); %设置位置 第一个pos是高 第二个是宽 *缩放倍数(只能是整数)
set(handles.pushbutton2,'CData',I); %将按钮的背景图片设置成I
position = get(handles.pushbutton3,'Position');
I = imread('2.png'); %读取图片
I = imresize(I, [position(4)*14 position(4)*20]); %设置位置 第一个pos是高 第二个是宽 *缩放倍数(只能是整数)
set(handles.pushbutton3,'CData',I); %将按钮的背景图片设置成I
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes main wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = main_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 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
axis off;
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
set(handles.slider1,'value',str2num(get(hObject,'string'))); %把输入到edit1的内容转换为num,赋值给滑块0
R=str2num(get(hObject,'string')); %牛顿环 透镜曲率半径
lamda=666.6e-9; %入射光波长0.000 066 660mm
[x y]=meshgrid(linspace(-0.004,0.004,400)); %视场范围
rr=(x.^2+y.^2) %各点到中心的距离
delta=pi*rr/(R*lamda)+pi/2; %相位差
I=cos(delta).^2; %干涉光强
imshow(I); %画图
xlabel(handles.axes1,'牛顿环图样');
% --- 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
% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (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,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
set(handles.edit1,'string',num2str(get(hObject,'value'))); %把滑块1的当前值转换成字符,string给edit1
R=get(hObject,'value'); %牛顿环 透镜曲率半径
lamda=666.6e-9; %入射光波长0.000 066 660mm
[x y]=meshgrid(linspace(-0.004,0.004,400)); %视场范围
rr=(x.^2+y.^2) %各点到中心的距离
delta=pi*rr/(R*lamda)+pi/2; %相位差
I=cos(delta).^2; %干涉光强
imshow(I); %画图
xlabel(handles.axes1,'牛顿环图样');
% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- 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)
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Matlab领域
- 粉丝: 3w+
- 资源: 3674
最新资源
- 电气数据417节点配电网数据
- 蒙特卡洛法场景生成+K-means聚类并削减 风电、光伏、负荷 Matlab 通过概率模型并根据weibull、beta、正态分布生成500次风电光伏、负荷场景,此基础上,基于Kmeans算法,分别对
- sgan.py 源文件,可以自行修改内容
- COVID-19 胸部 X 光图像和肺口罩图像语义分割数据
- python - 时间、日期知识汇总
- NC Cloud-集成-数据报表开发
- 基于多时间尺度滚动优化的多能源微网双层调度模型 参考文档:Collaborative Autonomous Optimization of Interconnected Multi-Energy S
- 2023-04-06-项目笔记 - 第三百七十三阶段 - 4.4.2.371全局变量的作用域-371 -2025.01.09
- python - 基础知识汇总
- 电气数据1080节点配电网数据
- 基于eNSP的企业网络规划与设计研究报告
- 2023-04-06-项目笔记 - 第三百七十三阶段 - 4.4.2.371全局变量的作用域-371 -2025.01.09
- NC Cloud-集成-业务插件注册
- VMD-LSSVM,基于VMD分解的LSSVM最小二乘支持向量机做短期电力负荷预测,预测精度非常高 结果分析 均方根误差(RMSE):0.42123 平均绝对误差(MAE):0.25901 平均相对
- 基于Python与Web前端的新年快乐动态礼花实现:代码教程和技术解析
- VMD-SSA-LSSVM,基于VMD分解的SSA优化LSSVM做短期电力负荷预测,预测精度非常高 结果分析 均方根误差(RMSE):0.17332 平均绝对误差(MAE):0.12619 平均相对
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈