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

📄 multint.m

📁 数值分析程序中的一个例子
💻 M
📖 第 1 页 / 共 2 页
字号:
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end% --- Executes during object creation, after setting all properties.function n_CreateFcn(hObject, eventdata, handles)% hObject    handle to n (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 during object creation, after setting all properties.function YD_CreateFcn(hObject, eventdata, handles)% hObject    handle to YD (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 during object creation, after setting all properties.function CT_CreateFcn(hObject, eventdata, handles)% hObject    handle to CT (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 button press in Closef.function Closef_Callback(hObject, eventdata, handles)close;% hObject    handle to Closef (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)function [I2 i]=MultipleIntegral(fcn,a,b,c,d,m0,n0,eps);i=0;I1=0;I2=0;while(i==0|abs(I2-I1)>eps)    m=m0*2^i;    n=n0*2^i;    h=(b-a)/m;    k=(d-c)/n;    x=a:h:b;    y=c:k:d;    X=zeros(m,1);    Y=zeros(n,1);    for p=1:m        X(p,1)=(x(p)+x(p+1))/2;    end    for q=1:n        Y(q,1)=(y(q)+y(q+1))/2;    end     S=zeros(m,n);    for p=1:m        for q=1:n             S(p,q)=h*k/4*(fxy(x(p),y(q))+fxy(x(p),y(q+1))...             +fxy(x(p+1),y(q))+fxy(x(p+1),y(q+1)));        end    end    TMN=sum(sum(S));    S=zeros(m,1);    for p=1:m        S(p,1)=fxy(X(p,1),y(1))+fxy(X(p,1),y(n+1));    end    T2MN=1/4*TMN+h*k/8*sum(sum(S));    S=zeros(n,1);    for q=1:n         S(q,1)=fxy(x(1),Y(q,1))+fxy(x(m+1),Y(q,1));    end    T2MN=T2MN++h*k/8*sum(sum(S));    S=zeros(m,n-1);    for p=1:m        for q=2:n            S(p,q-1)=fxy(X(p),y(q));        end    end    T2MN=T2MN+h*k/4*sum(sum(S));     S=zeros(m-1,n);    for p=2:m        for q=1:n            S(p-1,q)=fxy(x(p),Y(q));        end    end    T2MN=T2MN+h*k/4*sum(sum(S));    S=zeros(m,n);    for p=1:m        for q=1:n            S(p,q)=fxy(X(p),Y(q));        end    end    T2MN=T2MN+h*k/4*sum(sum(S));    i=i+1;    I1=I2;    I2=4/3*T2MN-TMN/3;    clear x y X Y S;end function a_Callback(hObject, eventdata, handles) a= get(gcbo,'String'); set(handles.a,'string',a); % hObject    handle to a (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 a as text%        str2double(get(hObject,'String')) returns contents of a as a doublefunction b_Callback(hObject, eventdata, handles) b= get(gcbo,'String'); set(handles.b,'string',b); % hObject    handle to b (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 b as text%        str2double(get(hObject,'String')) returns contents of b as a doublefunction d_Callback(hObject, eventdata, handles) d= get(gcbo,'String'); set(handles.d,'string',d); % hObject    handle to d (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 d as text%        str2double(get(hObject,'String')) returns contents of d as a doublefunction m_Callback(hObject, eventdata, handles) m= get(gcbo,'String'); set(handles.m,'string',m); % hObject    handle to m (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 m as text%        str2double(get(hObject,'String')) returns contents of m as a doublefunction n_Callback(hObject, eventdata, handles) n= get(gcbo,'String'); set(handles.n,'string',n); % hObject    handle to n (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 n as text%        str2double(get(hObject,'String')) returns contents of n as a doublefunction eps_Callback(hObject, eventdata, handles) eps= get(gcbo,'String'); set(handles.eps,'string',eps); % hObject    handle to eps (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 eps as text%        str2double(get(hObject,'String')) returns contents of eps as a double% --- Executes during object creation, after setting all properties.function eps_CreateFcn(hObject, eventdata, handles)% hObject    handle to eps (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');endfunction CT_Callback(hObject, eventdata, handles)% hObject    handle to CT (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 CT as text%        str2double(get(hObject,'String')) returns contents of CT as a doublefunction XD_Callback(hObject, eventdata, handles)% hObject    handle to XD (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 XD as text%        str2double(get(hObject,'String')) returns contents of XD as a double% --- Executes during object creation, after setting all properties.function XD_CreateFcn(hObject, eventdata, handles)% hObject    handle to XD (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');endfunction YD_Callback(hObject, eventdata, handles)% hObject    handle to YD (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 YD as text%        str2double(get(hObject,'String')) returns contents of YD as a double

⌨️ 快捷键说明

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