层状介质一维大地电磁数值模拟

news2024/10/7 16:17:15

层状介质一维大地电磁数值模拟

前言

大地电磁测深法( MT)是根据电磁感应原理研究天然场源在地下激励产生的交变电场或者磁场,通过地表观测到的电磁场或者通过电磁场计算出视电阻率或者相位等量来进行地下构造研究的一种电磁方法。由于它不需要建立人工场源,施工比较方便,另外它对良导体的分辨率能力强,受高阻地层的屏蔽影响较小,探测深度少则几十米,深可达几百公里,广泛应用于海上勘探、工程勘探、油气田勘探、地热资源调查、深部地质构造等地球物理领域。

本文应用网上找到的开源MT代码,进行一维大地电磁数值模拟研究。这个代码非常有意思,值得学习。

文章目录

  • 层状介质一维大地电磁数值模拟
    • 前言
    • 1、数值模拟结果
    • 2、层状介质一维大地电磁模拟GUI程序
    • 3、matlab代码

1、数值模拟结果

正演所用地电模型为一个简单模型,电性分布如下:
在这里插入图片描述
应用奥卡姆(OCCAM)反演算法,反演结果如下:
在这里插入图片描述
国外开源代码有很多,部分如下:
在这里插入图片描述

2、层状介质一维大地电磁模拟GUI程序

正演GUI程序
在这里插入图片描述
反演GUI程序
在这里插入图片描述

3、matlab代码

function varargout = MT_1D_Fwd(varargin)
% MT_1D_FWD MATLAB code for MT_1D_Fwd.fig
%      MT_1D_FWD, by itself, creates a new MT_1D_FWD or raises the existing
%      singleton*.
%
%      H = MT_1D_FWD returns the handle to a new MT_1D_FWD or the handle to
%      the existing singleton*.
%
%      MT_1D_FWD('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in MT_1D_FWD.M with the given input arguments.
%
%      MT_1D_FWD('Property','Value',...) creates a new MT_1D_FWD or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before MT_1D_Fwd_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to MT_1D_Fwd_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 MT_1D_Fwd

% Last Modified by GUIDE v2.5 09-Jul-2013 15:25:56

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @MT_1D_Fwd_OpeningFcn, ...
                   'gui_OutputFcn',  @MT_1D_Fwd_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 MT_1D_Fwd is made visible.
function MT_1D_Fwd_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 MT_1D_Fwd (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes MT_1D_Fwd wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = MT_1D_Fwd_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;



function edtLayersInput_Callback(hObject, eventdata, handles)
% hObject    handle to edtLayersInput (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 edtLayersInput as text
%        str2double(get(hObject,'String')) returns contents of edtLayersInput as a double


% --- Executes during object creation, after setting all properties.
function edtLayersInput_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edtLayersInput (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 edtT_Callback(hObject, eventdata, handles)
% hObject    handle to edtT (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 edtT as text
%        str2double(get(hObject,'String')) returns contents of edtT as a double


% --- Executes during object creation, after setting all properties.
function edtT_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edtT (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 btnSelFrqFile.
function btnSelFrqFile_Callback(hObject, eventdata, handles)
% hObject    handle to btnSelFrqFile (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    [FileName,PathName] = uigetfile('*.*','Select Frequency File');
    set(handles.edtT,'String',fullfile(PathName,FileName));
    DispPeriod(handles);

% --- Executes on button press in btnInputModelParams.
function btnInputModelParams_Callback(hObject, eventdata, handles)
% hObject    handle to btnInputModelParams (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

    %输入参数
    layers = str2double(get(handles.edtLayersInput,'String'));
    if isempty(layers)
        msgbox('层数应为整数');
        return;
    end

    in_colname={'层电阻率','层厚度'};
    in_colfmt = {'numeric','numeric'};
    in_coleditable = [true true];

    in_data=cell(layers,2);
    for i=1:layers    
        rhoVal = 100;
        if mod(i,2)==0, rhoVal = 10; end
        tVal = 200;
        in_data{i,1} = rhoVal;
        in_data{i,2} = tVal;
    end

    set(handles.btnZYCompute,'Enable','on');
    set(handles.tblLayersParamsInput, ... 
                'Data', in_data,... 
                'ColumnName', in_colname,...
                'ColumnFormat', in_colfmt,...
                'ColumnEditable', in_coleditable);
    DispPeriod(handles);

function T = GetPeriod(frqname)
    fileID = fopen(frqname);
    Frq = textscan(fileID,'%f');
    fclose(fileID);
    T = 1./Frq{1}';

function DispPeriod(handles)
    global out_data out_colname out_colfmt out_coleditable
    %填写周期
    T = GetPeriod(get(handles.edtT,'String'));
    out_data = cell(length(T),2);
    for iT=1:length(T)
        out_data{iT,1}=T(iT);
    end
    out_colname={'周期','正演视电阻率'};
    out_colfmt={'numeric','numeric'};
    out_coleditable=[false false]; 

    set(handles.tblAppRes, ... 
                'Data', out_data,... 
                'ColumnName', out_colname,...
                'ColumnFormat', out_colfmt,...
                'ColumnEditable', out_coleditable);

function editOutFile_Callback(hObject, eventdata, handles)
% hObject    handle to editOutFile (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 editOutFile as text
%        str2double(get(hObject,'String')) returns contents of editOutFile as a double


% --- Executes during object creation, after setting all properties.
function editOutFile_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editOutFile (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 btnSelOutFile.
function btnSelOutFile_Callback(hObject, eventdata, handles)
% hObject    handle to btnSelOutFile (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[FileName,PathName] = uiputfile('*.resp','Select Output Response File');
set(handles.editOutFile,'String',fullfile(PathName,FileName));


% --- Executes on button press in btnZYCompute.
function btnZYCompute_Callback(hObject, eventdata, handles)
% hObject    handle to btnZYCompute (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global out_data out_colname out_colfmt out_coleditable

%判断周期域数据的合法性
models_data=get(handles.tblLayersParamsInput,'Data');
layers = size(models_data,1);
Params = zeros(layers,2);
for i = 1:layers
    Params(i,1) = models_data{i,2}; % thickness
    Params(i,2) = models_data{i,1}; % resistivity
end
%画理论响应曲线    
Mu=4*pi*1e-7;
T = GetPeriod(get(handles.edtT,'String'));
FreqField=1./T;
OmegaField=2*pi.*FreqField;
Z0=MTLevelZ(1,layers,Params,FreqField) ;
Roho_a=((abs(Z0))).^2./OmegaField/Mu;

%填写正演视电阻率
for iRoho_a=1:length(Roho_a)
    out_data{iRoho_a,2}=Roho_a(iRoho_a);
end

set(handles.tblAppRes,'Data', out_data,... 
            'ColumnName', out_colname,...
            'ColumnFormat', out_colfmt,...
            'ColumnEditable', out_coleditable);

% out to file
outfile = get(handles.editOutFile,'String');
if ~isempty(outfile)
    dlmwrite(outfile,[FreqField;Roho_a]', ...
        'delimiter', '\t', 'precision', 10);
end

loglog(T,Roho_a);
xlabel('周期');
ylabel('视电阻率');


% --- Executes when entered data in editable cell(s) in tblLayersParamsInput.
function tblLayersParamsInput_CellEditCallback(hObject, eventdata, handles)
% hObject    handle to tblLayersParamsInput (see GCBO)
% eventdata  structure with the following fields (see UITABLE)
%	Indices: row and column indices of the cell(s) edited
%	PreviousData: previous data for the cell(s) edited
%	EditData: string(s) entered by the user
%	NewData: EditData or its converted form set on the Data property. Empty if Data was not changed
%	Error: error string when failed to convert EditData to appropriate value for Data
% handles    structure with handles and user data (see GUIDATA)


% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over btnInputModelParams.
function btnInputModelParams_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to btnInputModelParams (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on key press with focus on edtLayersInput and none of its controls.
function edtLayersInput_KeyPressFcn(hObject, eventdata, handles)
% hObject    handle to edtLayersInput (see GCBO)
% eventdata  structure with the following fields (see UICONTROL)
%	Key: name of the key that was pressed, in lower case
%	Character: character interpretation of the key(s) that was pressed
%	Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles    structure with handles and user data (see GUIDATA)


% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over edtLayersInput.
function edtLayersInput_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to edtLayersInput (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on key press with focus on btnInputModelParams and none of its controls.
function btnInputModelParams_KeyPressFcn(hObject, eventdata, handles)
% hObject    handle to btnInputModelParams (see GCBO)
% eventdata  structure with the following fields (see UICONTROL)
%	Key: name of the key that was pressed, in lower case
%	Character: character interpretation of the key(s) that was pressed
%	Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles    structure with handles and user data (see GUIDATA)


% --- Executes during object creation, after setting all properties.
function btnInputModelParams_CreateFcn(hObject, eventdata, handles)
% hObject    handle to btnInputModelParams (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called


% --- Executes during object deletion, before destroying properties.
function btnInputModelParams_DeleteFcn(hObject, eventdata, handles)
% hObject    handle to btnInputModelParams (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
function varargout = MT_1D_Inversion(varargin)
% MT_1D_INVERSION MATLAB code for MT_1D_Inversion.fig
%      MT_1D_INVERSION, by itself, creates a new MT_1D_INVERSION or raises the existing
%      singleton*.
%
%      H = MT_1D_INVERSION returns the handle to a new MT_1D_INVERSION or the handle to
%      the existing singleton*.
%
%      MT_1D_INVERSION('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in MT_1D_INVERSION.M with the given input arguments.
%
%      MT_1D_INVERSION('Property','Value',...) creates a new MT_1D_INVERSION or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before MT_1D_Inversion_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to MT_1D_Inversion_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 MT_1D_Inversion

% Last Modified by GUIDE v2.5 20-Jun-2013 01:15:14

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @MT_1D_Inversion_OpeningFcn, ...
                   'gui_OutputFcn',  @MT_1D_Inversion_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 MT_1D_Inversion is made visible.
function MT_1D_Inversion_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 MT_1D_Inversion (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes MT_1D_Inversion wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = MT_1D_Inversion_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;



function edtLayersInput_Callback(hObject, eventdata, handles)
% hObject    handle to edtLayersInput (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 edtLayersInput as text
%        str2double(get(hObject,'String')) returns contents of edtLayersInput as a double


% --- Executes during object creation, after setting all properties.
function edtLayersInput_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edtLayersInput (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 edtT_Callback(hObject, eventdata, handles)
% hObject    handle to edtT (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 edtT as text
%        str2double(get(hObject,'String')) returns contents of edtT as a double


% --- Executes during object creation, after setting all properties.
function edtT_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edtT (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 pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    [FileName,PathName] = uigetfile('*.*','Select Frequency File');
    set(handles.edtT,'String',fullfile(PathName,FileName));
    DispObsData(handles);

% --- Executes on button press in btnInputModelParams.
function btnInputModelParams_Callback(hObject, eventdata, handles)
% hObject    handle to btnInputModelParams (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    
    global in_data in_colname in_colfmt in_coleditable
    %输入参数
    layers = str2double(get(handles.edtLayersInput,'String'));
    if isempty(layers)
        msgbox('层数应为整数');
        return;
    end

    in_colname={'初始电阻率','初始厚度','反演电阻率','反演厚度'};
    in_colfmt = {'numeric','numeric','numeric','numeric'};
    in_coleditable = [true true false false];

    in_data=cell(layers,4);
    for i=1:layers    
        rhoVal = 10;
        tVal = 10;
        in_data{i,1} = rhoVal;
        in_data{i,2} = tVal;
    end

    set(handles.btnMTFY,'Enable','on');
    set(handles.tblLayersParamsInput, ... 
                'Data', in_data,... 
                'ColumnName', in_colname,...
                'ColumnFormat', in_colfmt,...
                'ColumnEditable', in_coleditable);
    DispObsData(handles);

function [T,AppRes] = LoadRespFile(frqname)
    fileID = fopen(frqname);
    data = textscan(fileID,'%f');
    fclose(fileID);
    data = reshape(data{1},2,[]);
    T = 1./data(1,:);
    AppRes = data(2,:);

function DispObsData(handles)
    global out_data out_colname out_colfmt out_coleditable
    %填写周期
    [T,AppRes] = LoadRespFile(get(handles.editRespFile,'String'));
    out_data = cell(length(T),4);
    for iT=1:length(T)
        out_data{iT,1}=T(iT);
        out_data{iT,2} = AppRes(iT);
    end
    out_colname={'周期','观测视电阻率','正演视电阻率','相对误差(%)'};
    out_colfmt={'numeric','numeric','numeric','numeric'};
    out_coleditable=[false false false false]; 

    set(handles.tblAppRes, ... 
                'Data', out_data,... 
                'ColumnName', out_colname,...
                'ColumnFormat', out_colfmt,...
                'ColumnEditable', out_coleditable);
	axes(handles.axesAppRes);
    cla;
    loglog(T,AppRes','-.gs','LineWidth',0.5,...
        'MarkerEdgeColor','k',...
        'MarkerFaceColor','g',...
        'MarkerSize',3);
    xlabel('周期');
    ylabel('视电阻率');
    legend('观测视电阻率');
    axes(handles.axesRMSErr);
    cla;
    xlabel('迭代次数');
    ylabel('目标函数残差');

function editRespFile_Callback(hObject, eventdata, handles)
% hObject    handle to editRespFile (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 editRespFile as text
%        str2double(get(hObject,'String')) returns contents of editRespFile as a double


% --- Executes during object creation, after setting all properties.
function editRespFile_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editRespFile (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 btnSelRespFile.
function btnSelRespFile_Callback(hObject, eventdata, handles)
% hObject    handle to btnSelRespFile (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    [FileName,PathName] = uigetfile('*.resp','Select Response File');
    set(handles.editRespFile,'String',fullfile(PathName,FileName));
    DispObsData(handles);


% --- Executes on button press in btnMTFY.
function btnMTFY_Callback(hObject, eventdata, handles)
% hObject    handle to btnMTFY (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    global in_data in_colname in_colfmt in_coleditable
	global out_data out_colname out_colfmt out_coleditable

    %判断目标函数残差数据的合法性
    Leq = str2double(get(handles.edtLeq,'String'));
    if isempty(Leq)
        msgbox('目标函数残差有误!');
        return;
    end
    %判断迭代次数数据的合法性
    IterationCount=str2double(get(handles.edtIterationCount,'String'));
    if isempty(IterationCount)
        msgbox('迭代次数有误!');
        return;
    end
    %判断显示一次迭代图数据的合法性
    DispPlotCounts=str2double(get(handles.edtDispPlotCounts,'String'));
    if isempty(DispPlotCounts)
        msgbox('显示一次迭代图数据有误!');
        return;
    end
    %判断周期域数据的合法性
    [T,AppRes] = LoadRespFile(get(handles.editRespFile,'String'));
    %简称输入参数
    in_data=get(handles.tblLayersParamsInput,'Data');
    layers = size(in_data,1);
    %读出初始模型
    Params0 = zeros(layers,2);
    for i = 1:layers
        Params0(i,1) = in_data{i,2}; % thickness
        Params0(i,2) = in_data{i,1}; % resistivity
    end
    data=in_data;

    % 以视电阻率相对误差为目标函数,地电参数皆用对数
    [ParamsIteration, dispPlotCounts, RealIterationCount1, Leq_RealIterationCount1, ...
        LastResponse]=IterationPTLK_MKTMethod(layers,Params0,T,AppRes,Leq, ...
        IterationCount,DispPlotCounts,handles.axesAppRes,handles.axesRMSErr);

    %填写反演结束的模型参数
    [row, col]=size(ParamsIteration);

    for irow=1:row
        data{irow,3}=ParamsIteration(irow,col);  % resistivity
        if irow<row
            data{irow,4}=ParamsIteration(irow,col-1);  % thickness
        end
    end
    set(handles.tblLayersParamsInput,'Data', data,... 
                'ColumnName', in_colname,...
                'ColumnFormat', in_colfmt,...
                'ColumnEditable', in_coleditable);

    %填写周期
    for iT=1:length(T)
        out_data{iT,3}=LastResponse(iT);
        out_data{iT,4}=abs((AppRes(iT)-LastResponse(iT))/AppRes(iT)*100);
    end

    set(handles.tblAppRes, ... 
                'Data', out_data,... 
                'ColumnName', out_colname,...
                'ColumnFormat', out_colfmt,...
                'ColumnEditable', out_coleditable);
            
function edtLeq_Callback(hObject, eventdata, handles)
% hObject    handle to edtLeq (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 edtLeq as text
%        str2double(get(hObject,'String')) returns contents of edtLeq as a double


% --- Executes during object creation, after setting all properties.
function edtLeq_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edtLeq (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 edtIterationCount_Callback(hObject, eventdata, handles)
% hObject    handle to edtIterationCount (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 edtIterationCount as text
%        str2double(get(hObject,'String')) returns contents of edtIterationCount as a double


% --- Executes during object creation, after setting all properties.
function edtIterationCount_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edtIterationCount (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 edtDispPlotCounts_Callback(hObject, eventdata, handles)
% hObject    handle to edtDispPlotCounts (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 edtDispPlotCounts as text
%        str2double(get(hObject,'String')) returns contents of edtDispPlotCounts as a double


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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/848374.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

★动态规划(DP算法)详解

什么是动态规划&#xff1a;动态规划_百度百科 内容太多了不作介绍&#xff0c;重点部分是无后效性&#xff0c;重叠子问题&#xff0c;最优子结构。 问S->P1和S->P2有多少种路径数&#xff0c;毫无疑问可以先从S开始深搜两次&#xff0c;S->P1和S->P2找出所有路…

【Linux】深入理解进程概念

个人主页&#xff1a;&#x1f35d;在肯德基吃麻辣烫 我的gitee&#xff1a;Linux仓库 个人专栏&#xff1a;Linux专栏 分享一句喜欢的话&#xff1a;热烈的火焰&#xff0c;冰封在最沉默的火山深处 文章目录 前言浅谈进程概念1. 进程和操作系统的联系2.描述进程的对象——PCB …

MongoDB:Linux环境全套安装指南

&#x1f60a; 作者&#xff1a; 一恍过去 &#x1f496; 主页&#xff1a; https://blog.csdn.net/zhuocailing3390 &#x1f38a; 社区&#xff1a; Java技术栈交流 &#x1f389; 主题&#xff1a; MongoDB&#xff1a;Linux环境全套安装指南 ⏱️ 创作时间&#xff1a…

Hybrid App 可以从哪些技术路径实现性能优化

说到 Hybrid App&#xff08;混合应用&#xff09;大家都不陌生&#xff0c;因为这种开发模式大行其道发展的这些年取代了很多原生和 Web 应用&#xff0c;为什么大家对这种「Native HTML5」的开发模式额外偏爱呢&#xff1f; 因为一方面在一定程度上兼顾了原生应用的优质体验…

compile_and_runtime_not_namespaced_r_class_jar\debug\R.jar: 另一个程序正在使用

问题情况&#xff1a; run App的时候&#xff0c;提示该文件被占用 想要clean Project&#xff0c;还是提示该文件被占用&#xff0c;这个文件和连带的文件夹都无法被删除。 方法1&#xff1a; AndroidStudio下方的terminal&#xff08;没有这个窗口的话&#xff0c;从上面的…

Java源码-Context源码解析

您好&#xff0c;我们来一起了解一下Java源码中的Context源码解析。 Context是Android中的一个重要的概念&#xff0c;在Android开发中可以用来获取应用程序的各种信息&#xff0c;如Activity、Service、Application等等。在Android中&#xff0c;Context是一个抽象类&#xf…

虚拟机centos7配置网络

虚拟机centos7配置网络 centos7克隆之后需要配置网络才能联网。 实验环境&#xff1a; VMware Workstation Pro 16CentOS 7系统虚拟机主机Windows 11系统 1.VMware网络模式设置为NAT模式 虚拟机–设置–网络适配器– ​​ ‍ 2.查看虚拟机 子网IP和网关IP 编辑–虚拟网…

AcWing 129:火车进栈 ← DFS

【题目来源】https://www.acwing.com/problem/content/131/【题目描述】 这里有 n 列火车将要进站再出站&#xff0c;但是&#xff0c;每列火车只有 1 节&#xff0c;那就是车头。 这 n 列火车按 1 到 n 的顺序从东方左转进站&#xff0c;这个车站是南北方向的&#xff0c;它虽…

【vue3】基础知识点-组合式api-recative和ref函数

学习vue3&#xff0c;都会从基础知识点学起。了解setup函数&#xff0c;ref&#xff0c;recative&#xff0c;watch、computed、pinia等如何使用 今天说vue3组合式api&#xff0c;响应式函数recative和ref函数 recative函数&#xff1a;接收对象类型数据的参数传入&#xff0…

激光雷达测距和摄像头联合棋盘格反射率标定板

目前&#xff0c;激光雷达不仅在军事上起到了重要的作用&#xff0c;而且发挥其测程大、精度高、反应速度快、可靠性高等优点&#xff0c;在商业领域应用越来越广&#xff0c;发展越来越迅速&#xff0c;具有较高的实用价值和商业价值。车载三维成像激光雷达采用脉冲式测量原理…

【PCL-6】PCL基于凹凸型的分割算法

凹凸型分割算法适用于颜色类似、棱角分明的物体场景分割。 算法流程&#xff1a; 1、基于超体聚类的过分割&#xff1b; 2、在超体聚类的基础上再聚类。 示例代码&#xff1a; //超体聚类LCCP //#include "stdafx.h"#include <stdlib.h> #include <cm…

Linux 安装软件的几种方式

哈喽大家好&#xff0c;我是咸鱼 相信小伙伴们都知道在 Linux 中&#xff0c;安装软件一般有三种方式 yum 安装rpm 安装源码编译安装 咸鱼平时三种安装方式都会用&#xff0c;但是具体原理和区别却没有去深入了解过 结果上周部门刚来的新人问我这几种安装方式的时候&#x…

连续四年入选!三项荣耀!博云科技强势上榜Gartner ICT技术成熟度曲线

日&#xff0c;全球知名咨询公司Gartner发布了2023年度的《中国ICT技术成熟度曲线》&#xff08;《Hype Cycle for ICT in China, 2023》&#xff0c;以下简称“报告”&#xff09;。令人瞩目的是&#xff0c;博云科技在报告中荣获三项殊荣&#xff0c;入选云原生计算&#xff…

【linux-keepalive】keepalive避免单点故障,高可用配置

keepalive: [rootproxy ~]# yum install -y keepalived [rootproxy ~]# vim /etc/keepalived/keepalived.conf global_defs {router_id proxy1 //设置路由ID号vrrp_iptables //不添加任何防火墙规则 } vrrp_instance V…

HTTP Status 404 – 未找到

这HTTP Status 404 – 未找到 我的问题就是啥呢 这里已经提示了原因有两个&#xff1a; ①&#xff1a;找不到 ②&#xff1a;资源被占用 我的问题就是找不到&#xff0c;找不到的问题也就说可能是文件路径不对&#xff0c;也可能是文件名不对&#xff0c;仔细检查两遍 apac…

Visual Studio实用调试技巧---让你成为高端的程序员

​ &#x1f341; 博客主页:江池俊的博客 &#x1f4a1;代码仓库&#xff1a;江池俊的代码仓库 &#x1f3aa; 社区&#xff1a;GeekHub &#x1f341; 如果觉得博主的文章还不错的话&#xff0c;请点赞&#x1f44d;收藏&#x1f31f; 三连支持一下博主&#x1f49e; 文章目录…

链式二叉树统计结点个数的方法和bug

方法一&#xff1a; 分治&#xff1a;分而治之 int BTreeSize1(BTNode* root) {if (root NULL) return 0;else return BTreeSize(root->left)BTreeSize(root->right)1; } 方法二&#xff1a; 遍历计数&#xff1a;设置一个计数器&#xff0c;对二叉树正常访问&#…

Spring 是如何解决循环依赖问题的?

项目场景&#xff1a; 提示&#xff1a;这里简述项目相关背景&#xff1a; 例如&#xff1a;项目场景&#xff1a;示例:通过蓝牙芯片(HC-05)与手机 APP 通信&#xff0c;每隔 5s 传输一批传感器数据(不是很大) 问题描述 我们都知道&#xff0c;如果在代码中&#xff0c;将两个…

高忆管理:券商板块探底回升,大市值券商企稳,中信建投涨超5%

近日活泼的券商板块8日盘中大幅回落&#xff0c;哈投股份一度跌停&#xff0c;后探底上升。大市值券商企稳&#xff0c;截至发稿&#xff0c;中金公司触及涨停&#xff0c;中信建投涨超5%。 首创证券一度大跌近9%&#xff0c;此前接连三日涨停&#xff0c;公司昨日晚间公告称&a…

【Vue】全家桶之vue-devtools

文章目录 概述安装使用componentsVuexEventsRoutingPerformanceSettings 来源 概述 Vue Devtools 是 Vue 官方发布的调试浏览器插件&#xff0c;可以安装在 Chrome 和 Firefox 等浏览器上&#xff0c;直接内嵌在开发者工具中&#xff0c;使用体验流畅。Vue Devtools 由 Vue.js…