✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

⛄ 内容介绍

研究背景重,磁异常的正演是重,磁力勘探中一项重要的工作,其主要目的就是已知场源分布求某位置上场.从正演问题的基本原理来看,主要有基于积分方程的正演和基于微分方程的正演这两种思想.前者通过积分方程进行积分得到其解析表达式或近似解析表达式,该方法适合于任何位置的正演计算

⛄ 部分代码

function varargout = cylinder(varargin)

% CYLINDER MATLAB code for cylinder.fig

%      CYLINDER, by itself, creates a new CYLINDER or raises the existing

%      singleton*.

%

%      H = CYLINDER returns the handle to a new CYLINDER or the handle to

%      the existing singleton*.

%

%      CYLINDER('CALLBACK',hObject,eventData,handles,...) calls the local

%      function named CALLBACK in CYLINDER.M with the given input arguments.

%

%      CYLINDER('Property','Value',...) creates a new CYLINDER or raises the

%      existing singleton*.  Starting from the left, property value pairs are

%      applied to the GUI before cylinder_OpeningFcn gets called.  An

%      unrecognized property name or invalid value makes property application

%      stop.  All inputs are passed to cylinder_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 cylinder

% Last Modified by GUIDE v2.5 29-Apr-2023 01:11:39

% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

gui_State = struct('gui_Name',       mfilename, ...

                   'gui_Singleton',  gui_Singleton, ...

                   'gui_OpeningFcn', @cylinder_OpeningFcn, ...

                   'gui_OutputFcn',  @cylinder_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 cylinder is made visible.

function cylinder_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 cylinder (see VARARGIN)

% Choose default command line output for cylinder

handles.output = hObject;

% Update handles structure

guidata(hObject, handles);

% UIWAIT makes cylinder wait for user response (see UIRESUME)

% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.

function varargout = cylinder_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 radiobutton1.

function radiobutton1_Callback(hObject, eventdata, handles)%画△g主剖面

% hObject    handle to radiobutton1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton1

global D

global t

G=6.67*1e-2;

x=-200:10:200;

g=(2*G*t*D)./(x.^2+D^2);

plot(x,g,'*-','MarkerEdgeColor','r');

box on;

xlabel('X(m)');

ylabel('△g.u.');

function edit2_Callback(hObject, eventdata, handles)%对埋深D赋值

% 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

global D

get(hObject,'String');

D=str2double(get(hObject,'String'));

handles.D=D;

guidata(hObject,handles);

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

function edit3_Callback(hObject, eventdata, handles)%对线密度t赋值

% 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

global t

get(hObject,'String');

t=str2double(get(hObject,'String'));

handles.t=t;

guidata(hObject,handles);

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

% --- Executes on button press in radiobutton2.

function radiobutton2_Callback(hObject, eventdata, handles)%画重力异常平面等值线图

% hObject    handle to radiobutton2 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton2

global D

global t

G=6.67*1e-2;

x=-200:10:200;

y=-200:10:200;

for i=1:size(x,2)

for j=1:size(x,2)

g(j,i)=(2*G*t*D)/(x(i)^2+D^2);

end

end

contourf(x,y,g,12);

colorbar;

box on;

xlabel('X(m)');

ylabel('Y(m)');

% --- Executes on button press in radiobutton3.

function radiobutton3_Callback(hObject, eventdata, handles)

% hObject    handle to radiobutton3 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton3

global D

global t

global az

global el

G=6.67*1e-2;

x=-200:10:200;

y=-200:10:200;

for i=1:size(x,2)

for j=1:size(x,2)

g(j,i)=(2*G*t*D)/(x(i)^2+D^2);

end

end

mesh(x,y,g);

view([az,el]);

colorbar;

box on;

xlabel('X(m)');

ylabel('Y(m)');

zlabel('△g.u.');

% --- Executes on button press in radiobutton5.

function radiobutton5_Callback(hObject, eventdata, handles)%画Vxz主剖面

% hObject    handle to radiobutton5 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton5

global D

global t

G=6.67*1e-2;

x=-200:10:200;;

Vxz=((4*G*t*(-D)).*x)./((x.^2+D^2).^2);

plot(x,Vxz,'*-','MarkerEdgeColor','r');

box on;

xlabel('X(m)');

ylabel('Vxz');

% --- Executes on button press in radiobutton7.

function radiobutton7_Callback(hObject, eventdata, handles)%画Vxz平面图

% hObject    handle to radiobutton7 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton7

global D

global t

G=6.67*1e-2;

x=-200:10:200;

y=-200:10:200;

for i=1:size(x,2)

for j=1:size(x,2)

Vxz(j,i)=(4*G*t*(-D)*x(i))/((x(i)^2++D^2).^2);

end

end

contourf(x,y,Vxz,12);

colorbar;

box on;

xlabel('X(m)');

ylabel('Y(m)');

zlabel('Vxz');

% --- Executes on button press in radiobutton8.

function radiobutton8_Callback(hObject, eventdata, handles)%画Vxz三维图

% hObject    handle to radiobutton8 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton8

global D

global t

global az

global el

G=6.67*1e-2;

x=-200:10:200;

y=-200:10:200;

for i=1:size(x,2)

for j=1:size(x,2)

Vxz(j,i)=(4*G*t*(-D)*x(i))/((x(i)^2+D^2).^2);

end

end

mesh(x,y,Vxz);

view([az,el]);     %视角控制

colorbar;

box on;

xlabel('X(m)');

ylabel('Y(m)');

zlabel('Vxz');

% --- Executes on button press in radiobutton9.

function radiobutton9_Callback(hObject, eventdata, handles)%画Vzz主剖面

% hObject    handle to radiobutton9 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton9

global D

global t

G=6.67*1e-2;

x=-200:10:200;

Vzz=(2*G*t*(D^2-x.^2))./((x.^2+D^2).^2);

plot(x,Vzz,'*-','MarkerEdgeColor','r');

% 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 edit7_Callback(hObject, eventdata, handles)%俯视角赋值

% hObject    handle to edit7 (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 edit7 as text

%        str2double(get(hObject,'String')) returns contents of edit7 as a double

global el

get(hObject,'String');

el=str2double(get(hObject,'String'));

handles.el=el;

guidata(hObject,handles);

% --- Executes during object creation, after setting all properties.

function edit7_CreateFcn(hObject, eventdata, handles)

% hObject    handle to edit7 (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 radiobutton17.

function radiobutton17_Callback(hObject, eventdata, handles)

% hObject    handle to radiobutton17 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

close

% Hint: get(hObject,'Value') returns toggle state of radiobutton17

% --- Executes on button press in gridon.

function gridon_Callback(hObject, eventdata, handles)

% hObject    handle to gridon (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of gridon

set(handles.gridoff,'Value',0)

grid on

% --- Executes on button press in gridoff.

function gridoff_Callback(hObject, eventdata, handles)

% hObject    handle to gridoff (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of gridoff

 set(handles.gridon,'Value',0)

grid off

% --------------------------------------------------------------------

function BOX1_Callback(hObject, eventdata, handles)

% hObject    handle to BOX1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% --------------------------------------------------------------------

function boxon_Callback(hObject, eventdata, handles)

% hObject    handle to boxon (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

box on

set(handles.boxon,'Enable','off','Checked','on')

set(handles.boxoff,'Enable','on','Checked','off')

% --------------------------------------------------------------------

function boxoff_Callback(hObject, eventdata, handles)

% hObject    handle to boxoff (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

box off

set(handles.boxoff,'Enable','off','Checked','on')

set(handles.boxon,'Enable','on','Checked','off')

% --- Executes on button press in radiobutton20.

function radiobutton20_Callback(hObject, eventdata, handles)

% hObject    handle to radiobutton20 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton20

⛄ 运行结果

【数学建模】基于matlab模拟水平圆柱体重力异常正演_MATLAB

【数学建模】基于matlab模拟水平圆柱体重力异常正演_MATLAB_02

⛄ 参考文献

[1] 陈石, 张健. 基于MPICH环境下的复杂重力异常体并行正演模拟[J]. 地震, 2013, 33(4):8.

[2] 李九亮. 重力异常半定量解释中的若干问题[J]. 物探与化探, 1983(1):11.

[3] 王芃, 张忠杰, 张晰,等. 基于Matlab平台实现二维复杂地质模型多边形网格建模及重力异常正演计算[J]. 桂林理工大学学报, 2014, 34(2):6.

[4] 王林, 王万银. 基于微分方程的重力异常正演探讨[C]// 2019年中国地球科学联合学术年会. 0.

[5] 徐世浙, 王硕儒, 任鲁川. 三维变密度体重力异常的正演[J]. 地质与勘探, 1984(10):46-48.

⛳️ 代码获取关注我

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料