Contents

hide

5.5 Computing misfits with MatLab

Basically, using MatLab for computing the forward problem is achieved with dinverext plugin described in previous section. The following command maybe entered:

MatLab command line (TODO snapshot of widget)
Working directory: ~/case_1
Command: /usr/bin/matlab
Arguments: -nodisplay -nodesktop -nosplash
Standard input: ~/yourscript.m

'yourscript.m' must read file 'parameters' which contains all variable parameters in column (one by line). On output, the misfit value must be passed in file 'misfit' (just one value on the first line). If 'misfit' does not exist or is empty when returning from script, the forward computation is assumed to have failed. These two files are created in Working Directory specified in dinver user interface.

MatLab script example
clear all                  % Clear all
close all
Error=0;                   % Init error flag
Param=load('parameters')   % Load variable parameters
                           % Begin forward computation
Misfit=1;
                           % End forward computation
fid=fopen('misfit','wt')   % Save misfit value
  if Error==1
    fprintf(fid,'%f',Misfit);
  end
fclose(fid)