📄 xiezhh1.m
字号:
hl=line([x(1:m-1);x(2:m)],[y(1:m-1);y(1:m-1)]);
set(hl,'color',str1);
hold on
stem(x,y,'fill',str1)
end
hold on
%x=hygeinv(0.5,n1,n2,n4);
%text(x,hygepdf(x,n1,n2,n4),['N=',num2str(n1),',','M=',num2str(n2),',','n=',num2str(n4)])
xlabel('X')
ylabel('F(x)')
%plot(zeros(11,1),0:0.1*max(y):max(y),':k')
end
else
warndlg('参数不能为空');
end
case 2
if ~isempty(n1)&~isempty(n2)
if round(n1)~=n1|n1<0|n2<=0|n2>=1
warndlg('请正确输入二项分布的参数');
else
x=binoinv(0.001,n1,n2):binoinv(0.999,n1,n2);
y=binocdf(x,n1,n2);
m=length(x);
if n>1
if rem(i,7)==0
hl=line([x(1:m-1);x(2:m)],[y(1:m-1);y(1:m-1)]);
set(hl,'color',str1(7));
hold on
stem(x,y,'fill',str1(7))
else
hl=line([x(1:m-1);x(2:m)],[y(1:m-1);y(1:m-1)]);
set(hl,'color',str1(rem(i,7)));
hold on
stem(x,y,'fill',str1(rem(i,7)))
end
else
hl=line([x(1:m-1);x(2:m)],[y(1:m-1);y(1:m-1)]);
set(hl,'color',str1);
hold on
stem(x,y,'fill',str1)
end
hold on
%x=binoinv(0.5,n1,n2);
%text(x,binopdf(x,n1,n2),['n=',num2str(n1),',','p=',num2str(n2)])
xlabel('X')
ylabel('F(x)')
%plot(zeros(11,1),0:0.1*max(y):max(y),':k')
end
else
warndlg('参数不能为空');
end
case 3
if ~isempty(n4)
if n4<=0
warndlg('请正确输入泊松分布的参数');
else
x=poissinv(0.001,n4):poissinv(0.999,n4);
y=poisscdf(x,n4);
m=length(x);
if n>1
if rem(i,7)==0
hl=line([x(1:m-1);x(2:m)],[y(1:m-1);y(1:m-1)]);
set(hl,'color',str1(7));
hold on
stem(x,y,'fill',str1(7))
else
hl=line([x(1:m-1);x(2:m)],[y(1:m-1);y(1:m-1)]);
set(hl,'color',str1(rem(i,7)));
hold on
stem(x,y,'fill',str1(rem(i,7)))
end
else
hl=line([x(1:m-1);x(2:m)],[y(1:m-1);y(1:m-1)]);
set(hl,'color',str1);
hold on
stem(x,y,'fill',str1)
end
hold on
%x=poissinv(0.5,n4);
%text(x,poisspdf(x,n4),['n=',num2str(n4)])
xlabel('X')
ylabel('F(x)')
%plot(zeros(11,1),0:0.1*max(y):max(y),':k')
end
else
warndlg('参数不能为空');
end
end
%set(edit_handle1,'string','')
%set(edit_handle2,'string','')
%set(edit_handle4,'string','')
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
cla
%edit_handle1=findobj(gcf,'tag','edit4');
%edit_handle2=findobj(gcf,'tag','edit5');
%edit_handle4=findobj(gcf,'tag','edit6');
%set(edit_handle1,'string','')
%set(edit_handle2,'string','')
%set(edit_handle4,'string','')
% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close 常见离散型分布
shiyan
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (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 edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
h=findobj(gcf,'tag','text19');
set(h,'string','泊松分布的参数');
edit_handle=findobj(gcf,'tag','edit4');
set(edit_handle,'string','');
edit2_handle=findobj(gcf,'tag','edit5');
set(edit2_handle,'string','');
edit3_handle=findobj(gcf,'tag','edit6');
set(edit3_handle,'string','');
pph=findobj(gcf,'tag','popupmenu3');
set(pph,'string','超几何分布|二项分布|泊松分布','FontSize',10)
pph=findobj(gcf,'tag','popupmenu4');
set(pph,'string','自动|蓝色|红色|黄色|绿色|品红|青色|黑色','FontSize',10)
% 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 edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (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 edit5 as text
% str2double(get(hObject,'String')) returns contents of edit5 as a double
% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (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 edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (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 edit6 as text
% str2double(get(hObject,'String')) returns contents of edit6 as a double
% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (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 selection change in popupmenu3.
function popupmenu3_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns popupmenu3 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu3
% --- Executes during object creation, after setting all properties.
function popupmenu3_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu 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 selection change in popupmenu4.
function popupmenu4_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns popupmenu4 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu4
% --- Executes during object creation, after setting all properties.
function popupmenu4_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu 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 + -