function varargout = j_1(varargin)
% J_1 MATLAB code for j_1.fig
% J_1, by itself, creates a new J_1 or raises the existing
% singleton*.
%
% H = J_1 returns the handle to a new J_1 or the handle to
% the existing singleton*.
%
% J_1('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in J_1.M with the given input arguments.
%
% J_1('Property','Value',...) creates a new J_1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before j_1_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to j_1_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 j_1
% Last Modified by GUIDE v2.5 25-Oct-2011 17:31:21
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @j_1_OpeningFcn, ...
'gui_OutputFcn', @j_1_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 j_1 is made visible.
function j_1_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 j_1 (see VARARGIN)
% Choose default command line output for j_1
handles.output = hObject;
guangpu=double(imread('光谱1.bmp'));
handles.guangpu=[guangpu(1,:,1); guangpu(1,:,2); guangpu(1,:,3)];
Lambda_value=600; %通过滑动条获取入射波长值
yanse=handles.guangpu(:, round(((Lambda_value-379)/371*600)),:)/255; %利用光谱图取得与入射波长相对应的颜色.
Lambda=Lambda_value/10^9;
d=1/1000; % 通过滑动条获取双缝间距
D=2; % 通过滑动条获取屏幕与双缝间距
[x,y]=meshgrid(linspace(-0.5,0.5,20) , linspace(-0.004,0.004,400));
L1=sqrt((y-d/2).^2+ D.^2);
L2=sqrt((y+d/2).^2+D.^2);
Phi=2*pi*(L2 - L1) /Lambda;
I=4*cos( Phi/2).^2; %计算屏幕上的光强分布
Pc(:,:,1)=I*yanse(1) ;
Pc(:,:,2)=I*yanse(2) ;
Pc(:,:,3)=I*yanse(3) ; %将包含颜色信息的光强用矩阵保存下来
axes(handles.axes1) ;
axis([-0.5 0.5 -0.004 0.004]);
image([-0.5 0.5],[-0.004 0.004],Pc/4); %显示屏幕上的仿真结果
xlabel('双缝干涉条纹的分布') ;
axes(handles.axes2);
plot(I,y); % 显示
axis([0 4 -0.004 0.004]);
xlabel('双缝干涉光强的分布') ;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes j_1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = j_1_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 slider movement.
function Lambda_slider_Callback(hObject, eventdata, handles)
% hObject handle to Lambda_slider (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
Lambda_value=get(handles.Lambda_slider, 'Value'); %通过滑动条获取入射波长值
set(handles.Lambda_edit, 'String', num2str(Lambda_value));
guangpu=double(imread('光谱1.bmp'));
handles.guangpu=[guangpu(1,:,1); guangpu(1,:,2); guangpu(1,:,3)];
Lambda_value=get(handles.Lambda_slider, 'Value'); %通过滑动条获取入射波长值
yanse=handles.guangpu(:, round(((Lambda_value-379)/371*600)))/255; %利用光谱图取得与入射波长相对应的颜色.
Lambda=Lambda_value/10^9;
d=get(handles.d_slider,'Value')/1000; % 通过滑动条获取双缝间距
D=get(handles.D_slider,'Value' ); % 通过滑动条获取屏幕与双缝间距
[x,y]=meshgrid(linspace(-0.5,0.5,20) , linspace(-0.004,0.004,400));
L1=sqrt((y-d/2).^2+ D.^2);
L2=sqrt((y+d/2).^2+D.^2);
Phi=2*pi*(L2 - L1) /Lambda;
I=4*cos( Phi/2).^2; %计算屏幕上的光强分布
Pc(:,:,1)=I*yanse(1) ;
Pc(:,:,2)=I*yanse(2) ;
Pc(:,:,3)=I*yanse(3) ; %将包含颜色信息的光强用矩阵保存下来
axes(handles.axes1) ;
axis([-0.5 0.5 -0.004 0.004]);
image([-0.5 0.5],[-0.004 0.004],Pc/4); %显示屏幕上的仿真结果
xlabel('双缝干涉条纹的分布') ;
axes(handles.axes2);
plot(I,y); % 显示
axis([0 4 -0.004 0.004]);
xlabel('双缝干涉光强的分布') ;
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function Lambda_slider_CreateFcn(hObject, eventdata, handles)
% hObject handle to Lambda_slider (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
set(hObject, 'Value', 600);
set(hObject, 'Max', 780);
set(hObject, 'Min', 390);
set(hObject, 'Sliderstep', [0.03 0.05]);
% --- Executes on slider movement.
function d_slider_Callback(hObject, eventdata, handles)
% hObject handle to d_slider (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.d_edit, 'String', num2str(get(handles.d_slider, 'Value')));
guangpu=double(imread('光谱1.bmp'));
handles.guangpu=[guangpu(1,:,1); guangpu(1,:,2); guangpu(1,:,3)];
Lambda_value=get(handles.Lambda_slider, 'Value'); %通过滑动条获取入射波长值
yanse=handles.guangpu(:, round(((Lambda_value-379)/371*600)))/255; %利用光谱图取得与入射波长相对应的颜色.
Lambda=Lambda_value/10^9;
d=get(handles.d_slider,'Value')/1000; % 通过滑动条获取双缝间距
D=get(handles.D_slider,'Value' ); % 通过滑动条获取屏幕与双缝间距
[x,y]=meshgrid(linspace(-0.5,0.5,20) , linspace(-0.004,0.004,400));
L1=sqrt((y-d/2).^2+ D.^2);
L2=sqrt((y+d/2).^2+D.^2);
Phi=2*pi*(L2 - L1) /Lambda;
I=4*cos( Phi/2).^2; %计算屏幕上的光强分布
Pc(:,:,1)=I*yanse(1) ;
Pc(:,:,2)=I*yanse(2) ;
Pc(:,:,3)=I*yanse(3) ; %将包含颜色信息的光强用矩阵保存下来
axes(handles.axes1) ;
axis([-0.5 0.5 -0.004 0.004]);
image([-0.5 0.5],[-0.004 0.004],Pc/4); %显示屏幕上的仿真结果
xlabel('双缝干涉条纹的分布') ;
axes(handles.axes2);
plot(I,y); % 显示
axis([0 4 -0.004 0.004]);
xlabel('双缝干涉光强的分布') ;
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function d_slider_CreateFcn(hObject, eventdata, handles)
% hObject handle to d_slider (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
set(hObject, 'Value', 1);
set(hObject, 'Max', 3);
set(hObject, 'Min', 0.5);
set(hObject, 'Sliderstep', [0.01 0.05]);
% --- Executes on slider movement.
fu
阿里matlab建模师
- 粉丝: 4594
- 资源: 2868
最新资源
- 含风电光伏光热电站电力系统N-k安全优化调度模型 关键词:N-K安全约束 光热电站 优化调度 参考文档:《光热电站促进风电消纳的电力系统优化调度》参考光热电站模型; 仿真平台: MATLAB +YA
- PCB SCREEN PRINTER电路板丝印机step全套技术资料100%好用.zip
- 大数据存储HBase与Cassandra部署与应用实例-图书管理系统的构建
- 李团结业务招待费申报表20250104.pdf
- 基于python+pyqt5+mysql实现的学生宿舍管理系统源码+GUI界面(高分课设)
- 【DOA估计】基于matlab谱峰搜索传播算子算法PM波达角估计【含Matlab源码 10933期】.zip
- 【尺寸测量】基于matlab医学图像肾结石识别和长度测量(含中值滤波)【含Matlab源码 10922期】.zip
- 【化学】基于matlab迁移活性位点的催化反应过程模拟【含Matlab源码 10932期】.zip
- 【数据驱动】基于matlab动力系统数据驱动学习和控制【含Matlab源码 10925期】.zip
- 【模型控制】基于matlab模型的预测控制应用【含Matlab源码 10928期】.zip
- 【数据分析】基于matlab时域数据分数混沌系统稀疏识别【含Matlab源码 10929期】.zip
- 【数据驱动】基于matlab复杂网络数据驱动控制【含Matlab源码 10923期】.zip
- 【数据驱动】基于matlab概率性能保证的自动控制器调整数据驱动场景优化【含Matlab源码 10931期】.zip
- 【数据驱动】基于matlab动力系统数值分析、DMD和库普曼算子理论【含Matlab源码 10924期】.zip
- rk 3566刷机工具包
- 【数据驱动】基于matlab库普曼算子的凸公式求解数据驱动的最优控制问题【含Matlab源码 10926期】.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈