📄 xiezhh5.m
字号:
function varargout = xiezhh5(varargin)
% XIEZHH5 M-file for xiezhh5.fig
% XIEZHH5, by itself, creates a new XIEZHH5 or raises the existing
% singleton*.
%
% H = XIEZHH5 returns the handle to a new XIEZHH5 or the handle to
% the existing singleton*.
%
% XIEZHH5('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in XIEZHH5.M with the given input arguments.
%
% XIEZHH5('Property','Value',...) creates a new XIEZHH5 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before xiezhh5_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to xiezhh5_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
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help xiezhh5
% Last Modified by GUIDE v2.5 07-Sep-2006 20:56:22
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @xiezhh5_OpeningFcn, ...
'gui_OutputFcn', @xiezhh5_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 xiezhh5 is made visible.
function xiezhh5_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 xiezhh5 (see VARARGIN)
% Choose default command line output for xiezhh5
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes xiezhh5 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = xiezhh5_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)
edit_handle1=findobj(gcf,'tag','edit1');
n1=get(edit_handle1,'string');
n1=str2num(n1);
edit_handle2=findobj(gcf,'tag','edit2');
n2=get(edit_handle2,'string');
n2=str2num(n2);
if ~isempty(n1)&~isempty(n2)
if n1<0|round(n2)~=n2|n2<0
warndlg('请输入正确的参数');
else
xinv1=gaminv(0.001,n2,n1);
xinv2=gaminv(0.999,n2,n1);
x=xinv1+eps:0.01*(xinv2-xinv1):xinv2;
y=gampdf(x,n2,n1);
plot(x,y,'b')
hold on
mu=n2*n1;
sigma=sqrt(n2*(n1^2));
x=mu-3.2*sigma:6.4*sigma/100:mu+3.2*sigma;
y=normpdf(x,mu,sigma);
plot(x,y,'r')
xlabel('X')
ylabel('f(x)')
text(mu+0.5*sigma,0.95*normpdf(mu,mu,sigma),['\mu=',num2str(mu),',','\sigma=',num2str(sigma),'正态分布(红)'])
text(gaminv(0.5,n2,n1),gampdf(gaminv(0.5,n2,n1),n2,n1),['\lambda=',num2str(n1),',','随机变量和的分布(蓝)'])
end
else
warndlg('参数不能为空');
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)
cla
% --- 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)
close 独立同分布的中心极限定理
xiezhh4
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
edit1_handle=findobj(gcf,'tag','edit1');
set(edit1_handle,'string','')
edit2_handle=findobj(gcf,'tag','edit2');
set(edit2_handle,'string','')
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -