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

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

前言

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

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

文章目录

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

1、数值模拟结果

正演所用地电模型为一个简单模型,电性分布如下:
层状介质一维大地电磁数值模拟_第1张图片
应用奥卡姆(OCCAM)反演算法,反演结果如下:
层状介质一维大地电磁数值模拟_第2张图片
国外开源代码有很多,部分如下:
层状介质一维大地电磁数值模拟_第3张图片

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

正演GUI程序
层状介质一维大地电磁数值模拟_第4张图片
反演GUI程序
层状介质一维大地电磁数值模拟_第5张图片

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

你可能感兴趣的:(图像处理)