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

📄 bqd.m

📁 matlab进行不确度计算
💻 M
字号:
function varargout = bqd(varargin)
% BQD M-file for bqd.fig
%      BQD, by itself, creates a new BQD or raises the existing
%      singleton*.
%
%      H = BQD returns the handle to a new BQD or the handle to
%      the existing singleton*.
%
%      BQD('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in BQD.M with the given input arguments.
%
%      BQD('Property','Value',...) creates a new BQD or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before bqd_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to bqd_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 bqd

% Last Modified by GUIDE v2.5 05-Jun-2006 11:05:51
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @bqd_OpeningFcn, ...
                   'gui_OutputFcn',  @bqd_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin & isstr(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
%clear dataInput;
%clear n;

% --- Executes just before bqd is made visible.
function bqd_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 bqd (see VARARGIN)

% Choose default command line output for bqd
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);
% UIWAIT makes bqd wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = bqd_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 InputValues_CreateFcn(hObject, eventdata, handles)% hObject    handle to InputValues (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction InputValues_Callback(hObject, eventdata, handles)% hObject    handle to InputValues (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 InputValues as text%        str2double(get(hObject,'String')) returns contents of InputValues as a double
% --- Executes on button press in CalBQD.function CalBQD_Callback(hObject, eventdata, handles)% hObject    handle to CalBQD (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)
global dataInput n
stralpha = get(handles.edit_1a,'String');   
alpha = 1 - str2num(stralpha);%致信度
strSyserr = get(handles.edit_Syserr,'String');
Syserr = str2num(strSyserr);    %系统误差
n = length(dataInput);          %数据个数
[dataOut1,dataOut2,dataOut3] = Auncertainty(dataInput,Syserr,alpha);%计算不确定度
    
set(handles.Result1,'String',num2str(dataOut1));

axes(handles.ResultFigure);           %激活ResultFigure
%进行绘图操作
plot([1:n],dataInput,'*');  %绘离散点
hold on;    
plot([0,n],[mean(dataInput),mean(dataInput)]);  %会均值直线
hold off;

set(handles.Result2,'String',num2str(dataOut2));
set(handles.Result,'String',num2str(dataOut3));

resultvalue=[dataInput-dataOut3;dataInput+dataOut3];set(handles.resultValue,'String',num2str(resultvalue'));% --- Executes during object creation, after setting all properties.function Result1_CreateFcn(hObject, eventdata, handles)% hObject    handle to Result1 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction Result1_Callback(hObject, eventdata, handles)% hObject    handle to Result1 (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 Result1 as text%        str2double(get(hObject,'String')) returns contents of Result1 as a
%        double% --- Executes during object creation, after setting all properties.function edit_1a_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit_1a (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit_1a_Callback(hObject, eventdata, handles)% hObject    handle to edit_1a (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 edit_1a as text%        str2double(get(hObject,'String')) returns contents of edit_1a as a double% --- 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)
global dataInput
dataInputstr = get(handles.InputValues,'String');       %获取编辑框中的值
dataInput = str2num(dataInputstr);                      %转化为数字% --- Executes on button press in pushbutton_load.function pushbutton_load_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton_load (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)
global dataInput n
[dataInput,n] = GetData('InputData');%从数据库获取数据
set(handles.InputValues,'String',num2str(dataInput));% --- Executes during object creation, after setting all properties.function edit_Syserr_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit_Syserr (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit_Syserr_Callback(hObject, eventdata, handles)% hObject    handle to edit_Syserr (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 edit_Syserr as text%        str2double(get(hObject,'String')) returns contents of edit_Syserr as a double% --- Executes during object creation, after setting all properties.function Result2_CreateFcn(hObject, eventdata, handles)% hObject    handle to Result2 (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction Result2_Callback(hObject, eventdata, handles)% hObject    handle to Result2 (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 Result2 as text%        str2double(get(hObject,'String')) returns contents of Result2 as a double% --- Executes during object creation, after setting all properties.function Result_CreateFcn(hObject, eventdata, handles)% hObject    handle to Result (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction Result_Callback(hObject, eventdata, handles)% hObject    handle to Result (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 Result as text%        str2double(get(hObject,'String')) returns contents of Result as a
%        double% --- Executes during object creation, after setting all properties.function resultValue_CreateFcn(hObject, eventdata, handles)% hObject    handle to resultValue (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction resultValue_Callback(hObject, eventdata, handles)% hObject    handle to resultValue (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 resultValue as text%        str2double(get(hObject,'String')) returns contents of resultValue as a double% --- Executes during object creation, after setting all properties.function resultValue1_CreateFcn(hObject, eventdata, handles)% hObject    handle to resultValue1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: listbox controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in resultValue1.function resultValue1_Callback(hObject, eventdata, handles)% hObject    handle to resultValue1 (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 resultValue1 contents as cell array%        contents{get(hObject,'Value')} returns selected item from resultValue1

⌨️ 快捷键说明

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