⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xiezhh2.m

📁 概率统计实验源程序!这是一个学习使用概率中心极限定理的工具箱
💻 M
📖 第 1 页 / 共 2 页
字号:
                        plot(x,y,str1(7))
                    else
                        plot(x,y,str1(rem(i,7)))
                    end
                else
                    plot(x,y,str1)
                end
                hold on
                %text(n1+0.5*n2,0.95*normpdf(n1,n1,n2),['\mu=',num2str(n1),',','\sigma=',num2str(n2)])
                xlabel('X')
                ylabel('F(x)')
                plot(n1*ones(11,1),0:0.1*max(y):max(y),':k')
                h=refline(0,0.5);
                set(h,'color',[0,0,0],'LineStyle',':')
            end
        else            
            warndlg('参数不能为空');
        end
        
    case 2
        if ~isempty(n1)&~isempty(n2)
            if n1>=n2
                warndlg('请正确输入均匀分布的参数,左端点应小于右端点');
            else
                x=n1-0.2*(n2-n1):(n2-n1)/100:n2+0.2*(n2-n1);
                y=unifcdf(x,n1,n2);
                if n>1
                    if rem(i,7)==0
                        plot(x,y,str1(7))
                        set(gca,'Ylim',[0 1.2])
                    else
                        plot(x,y,str1(rem(i,7)))
                        set(gca,'Ylim',[0 1.2])
                    end
                else
                    plot(x,y,str1)
                    set(gca,'Ylim',[0 1.2])
                end
                hold on
                %text((n1+n2)/2,1.2/(n2-n1),['a=',num2str(n1),',','b=',num2str(n2)])
                xlabel('X')
                ylabel('F(x)')
                plot((n1+n2)/2*ones(11,1),0:0.1*max(y):max(y),':k')
                h=refline(0,0.5);
                set(h,'color',[0,0,0],'LineStyle',':')
            end
        else
            warndlg('参数不能为空');
        end
       
    case 3
        if ~isempty(n4)
            if n4<=0
                warndlg('指数分布的参数只能为正整数');
            else
                xinv1=expinv(0.001,n4);
                xinv2=expinv(0.999,n4);
                x=xinv1+eps:0.01*(xinv2-xinv1):xinv2;
                y=expcdf(x,n4);
                if n>1
                    if rem(i,7)==0
                        plot(x,y,str1(7))                        
                    else
                        plot(x,y,str1(rem(i,7)))                        
                    end
                else
                    plot(x,y,str1)                    
                end
                hold on
                %text(expinv(0.5,n4),exppdf(expinv(0.5,n4),n4),['\lambda=',num2str(n4)])
                xlabel('X')
                ylabel('F(x)') 
                plot(log(2)*n4*ones(11,1),0:0.1*max(y):max(y),':k')
                h=refline(0,0.5);
                set(h,'color',[0,0,0],'LineStyle',':')                
            end
        else
            warndlg('参数不能为空');
        end     
end
%set(edit_handle1,'string','')
%set(edit_handle2,'string','')
%set(edit_handle4,'string','')


% --- 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)

cla
axis auto
%edit_handle1=findobj(gcf,'tag','edit1');
%edit_handle2=findobj(gcf,'tag','edit2');
%edit_handle4=findobj(gcf,'tag','edit3');
%set(edit_handle1,'string','')
%set(edit_handle2,'string','')
%set(edit_handle4,'string','')

% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (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 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

edit_handle=findobj(gcf,'tag','edit1');
set(edit_handle,'string','');
edit2_handle=findobj(gcf,'tag','edit2');
set(edit2_handle,'string','');
edit3_handle=findobj(gcf,'tag','edit3');
set(edit3_handle,'string','');
pph=findobj(gcf,'tag','popupmenu1');
set(pph,'string','正态分布|均匀分布|指数分布','FontSize',10)
pph=findobj(gcf,'tag','popupmenu2');
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 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


% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (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 popupmenu1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu1


% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (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 popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu2 (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 popupmenu2 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu2


% --- Executes during object creation, after setting all properties.
function popupmenu2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu2 (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



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


% --- 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


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -