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

📄 asufit.c

📁 ASUFIT-Matlab-全局拟合程序
💻 C
📖 第 1 页 / 共 5 页
字号:
     * % otherwise, no data present in workspace
     * global dispersionStatus % == 0 -> no dispersion correction
     * % == 1 -> correct during fit
     * % == 2 -> data already changed
     * global dataIntervalStatus % == 0 -> use all of the data
     * % == 1 -> use interval for fit
     * % == 2 -> use interval now
     * global backupTypes % == 0 -> no backups
     * % == 1 -> dataBackup1 is data before dispersion and SVD
     * %         dataBackup2 is data with dispersion but before SVD
     * % == 2 -> dataBackup1 is data before dispersion and SVD
     * %         dataBackup2 is data with SVD but before dispersion
     * global svdAnal
     * global abstimelin
     * global fitmodel
     * 
     * 
     * % Real variables
     * global data
     * global dataMax
     * global dataMin
     * global fit
     * global irf
     * global amps
     * global weight
     * global emit
     * global excite
     * global tpch
     * global date
     * global spcFilenames
     * global irfFilenames
     * global numTao
     * global tao
     * global numTaoFixed
     * global taoFixed
     * global pulseWidth
     * global absFilename
     * global restoreName
     * global absYTicks
     * global wavelength
     * global t
     * global dataFit
     * global disperCoeffs
     * global dispvecguess
     * global leftInt
     * global rightInt
     * global xTol
     * global fTol
     * global maxIt
     * global OPTIONS
     * global OPT_STOP
     * global paramsAns
     * global chisq
     * global taoAns
     * global shiftGuess
     * global shift
     * global tzero
     * global fitError
     * global dataBackup
     * global U
     * global S
     * global V
     * global numVecs
     * global dispersionVector
     * global pathname
     * global numTimePoints1
     * global numTimePoints2
     * global fitconst
     * global name
     * 
     * 
     * if (nargin < 1)
     */
    if (mlfTobool(mlfLt(nargin_, mlfScalar(1.0)))) {
        /*
         * action = 'initialize';
         */
        mlfAssign(&action, mxCreateString("initialize"));
    /*
     * end
     */
    }
    /*
     * 
     * if (strcmp(action, 'initialize'))
     */
    if (mlfTobool(mlfStrcmp(action, mxCreateString("initialize")))) {
        /*
         * % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
         * % This action argument sets up Asufit for the first time, no data is present in
         * % the workspace.
         * % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
         * 
         * % --- The following commands set up the figure window and all plot axes
         * 
         * pathname = 'c:\'; %default data pathname
         */
        mlfAssign(&pathname, mxCreateString("c:\\"));
        /*
         * mainWindow = ... % Main figure window
         */
        mlfAssign(
          &mainWindow,
          mlfNFigure(
            1,
            mxCreateString("Name"),
            mxCreateString("ASUFIT-Data Analysis Software"),
            mxCreateString("NumberTitle"),
            mxCreateString("off"),
            mxCreateString("MenuBar"),
            mxCreateString("none"),
            mxCreateString("Units"),
            mxCreateString("normalized"),
            mxCreateString("Position"),
            mlfDoubleMatrix(1, 4, __Array0_r, NULL),
            mxCreateString("Color"),
            mlfDoubleMatrix(1, 3, __Array1_r, NULL),
            mxCreateString("Visible"),
            mxCreateString("off"),
            NULL));
        /*
         * figure(...
         * 'Name',        'ASUFIT-Data Analysis Software',...
         * 'NumberTitle', 'off',...
         * 'MenuBar', 'none',...
         * 'Units',       'normalized',...
         * 'Position',    [.05 .05 .9 .9],...
         * 'Color',       [0.8 0.8 0.8],...
         * 'Visible',     'off'...
         * );
         * spcDataGrid = ... % SPC data axes
         */
        mlfAssign(
          &spcDataGrid,
          mlfNAxes(
            1,
            mxCreateString("Position"),
            mlfDoubleMatrix(1, 4, __Array2_r, NULL),
            mxCreateString("Visible"),
            mxCreateString("off"),
            mxCreateString("DrawMode"),
            mxCreateString("fast"),
            NULL));
        /*
         * axes(...
         * 'Position',  [0.06 .3 0.88 0.55],...
         * 'Visible',  'off',...
         * 'DrawMode', 'fast'...
         * );
         * spcResidGrid = ... % SPC fit residual axes
         */
        mlfAssign(
          &spcResidGrid,
          mlfNAxes(
            1,
            mxCreateString("Position"),
            mlfDoubleMatrix(1, 4, __Array3_r, NULL),
            mxCreateString("Visible"),
            mxCreateString("off"),
            mxCreateString("DrawMode"),
            mxCreateString("fast"),
            NULL));
        /*
         * axes(...
         * 'Position', [0.06 .2 0.88 0.07],...
         * 'Visible',  'off',...
         * 'DrawMode', 'fast'...
         * );
         * absDataGrid1 = ... % Temporal axes for absorbance
         */
        mlfAssign(
          &absDataGrid1,
          mlfNAxes(
            1,
            mxCreateString("Position"),
            mlfDoubleMatrix(1, 4, __Array4_r, NULL),
            mxCreateString("Visible"),
            mxCreateString("off"),
            mxCreateString("DrawMode"),
            mxCreateString("fast"),
            NULL));
        /*
         * axes(...
         * 'Position', [0.05 .37 0.425 0.47],...
         * 'Visible',  'off',...
         * 'DrawMode', 'fast'...
         * );
         * absDataGrid2 = ... % Spectral axes for absorbance
         */
        mlfAssign(
          &absDataGrid2,
          mlfNAxes(
            1,
            mxCreateString("Position"),
            mlfDoubleMatrix(1, 4, __Array5_r, NULL),
            mxCreateString("Visible"),
            mxCreateString("off"),
            mxCreateString("DrawMode"),
            mxCreateString("fast"),
            NULL));
        /*
         * axes(...
         * 'Position', [0.525 .37 0.425 0.47],...
         * 'Visible',  'off',...
         * 'DrawMode', 'fast'...
         * );
         * absResidGrid1 = ... % Temporal residual axes
         */
        mlfAssign(
          &absResidGrid1,
          mlfNAxes(
            1,
            mxCreateString("Position"),
            mlfDoubleMatrix(1, 4, __Array6_r, NULL),
            mxCreateString("Visible"),
            mxCreateString("off"),
            mxCreateString("DrawMode"),
            mxCreateString("fast"),
            NULL));
        /*
         * axes( ...
         * 'Position', [0.05 .12 0.425 0.2],...
         * 'Visible',  'off',...
         * 'DrawMode', 'fast'...
         * );
         * absResidGrid2 = ... % Spectral residual axes
         */
        mlfAssign(
          &absResidGrid2,
          mlfNAxes(
            1,
            mxCreateString("Position"),
            mlfDoubleMatrix(1, 4, __Array7_r, NULL),
            mxCreateString("Visible"),
            mxCreateString("off"),
            mxCreateString("DrawMode"),
            mxCreateString("fast"),
            NULL));
        /*
         * axes( ...
         * 'Position', [0.525 .12 0.425 0.2],...
         * 'Visible',  'off',...
         * 'DrawMode', 'fast'...
         * );
         * absIntSetAxes1 = ...
         */
        mlfAssign(
          &absIntSetAxes1,
          mlfNAxes(
            1,
            mxCreateString("Position"),
            mlfDoubleMatrix(1, 4, __Array8_r, NULL),
            mxCreateString("Visible"),
            mxCreateString("off"),
            mxCreateString("DrawMode"),
            mxCreateString("fast"),
            NULL));
        /*
         * axes(...
         * 'Position', [.07 .45 0.4 0.42],...
         * 'Visible',  'off',...
         * 'DrawMode', 'fast'...
         * );
         * absIntSetAxes2 = ...
         */
        mlfAssign(
          &absIntSetAxes2,
          mlfNAxes(
            1,
            mxCreateString("Position"),
            mlfDoubleMatrix(1, 4, __Array9_r, NULL),
            mxCreateString("Visible"),
            mxCreateString("off"),
            mxCreateString("DrawMode"),
            mxCreateString("fast"),
            NULL));
        /*
         * axes(...
         * 'Position', [.53 .45 0.4 0.42],...
         * 'Visible',  'off',...
         * 'DrawMode', 'fast'...
         * );
         * svdGrid1 = ... % Temporal residual axes
         */
        mlfAssign(
          &svdGrid1,
          mlfNAxes(
            1,
            mxCreateString("Position"),
            mlfDoubleMatrix(1, 4, __Array10_r, NULL),
            mxCreateString("Visible"),
            mxCreateString("off"),
            mxCreateString("DrawMode"),
            mxCreateString("fast"),
            NULL));
        /*
         * axes( ...
         * 'Position', [0.05 .47 0.35 0.37],...
         * 'Visible',  'off',...
         * 'DrawMode', 'fast'...
         * );
         * svdGrid2 = ... % Spectral residual axes
         */
        mlfAssign(
          &svdGrid2,
          mlfNAxes(
            1,
            mxCreateString("Position"),
            mlfDoubleMatrix(1, 4, __Array11_r, NULL),
            mxCreateString("Visible"),
            mxCreateString("off"),
            mxCreateString("DrawMode"),
            mxCreateString("fast"),
            NULL));
        /*
         * axes( ...
         * 'Position', [0.45 .47 0.35 0.37],...
         * 'Visible',  'off',...
         * 'DrawMode', 'fast'...
         * );
         * svdGrid3 = ... %component axes
         */
        mlfAssign(
          &svdGrid3,
          mlfNAxes(
            1,
            mxCreateString("Position"),
            mlfDoubleMatrix(1, 4, __Array12_r, NULL),
            mxCreateString("Visible"),
            mxCreateString("off"),
            mxCreateString("DrawMode"),
            mxCreateString("fast"),
            NULL));
        /*
         * axes( ...
         * 'Position', [0.45 .05 0.35 0.37],...
         * 'Visible',  'off',...
         * 'DrawMode', 'fast'...
         * );
         * spcIntSetAxes = ...
         */
        mlfAssign(
          &spcIntSetAxes,
          mlfNAxes(
            1,
            mxCreateString("Position"),
            mlfDoubleMatrix(1, 4, __Array13_r, NULL),
            mxCreateString("Visible"),
            mxCreateString("off"),
            mxCreateString("DrawMode"),
            mxCreateString("fast"),
            NULL));
        /*
         * axes(...
         * 'Position', [.07 .45 0.86 0.42],...
         * 'Visible',  'off',...
         * 'DrawMode', 'fast'...
         * );
         * 
         * % --- The following commands set up the menus on the menu bar
         * 
         * dataFile = ... % Pull-down menu for file operations
         */
        mlfAssign(
          &dataFile,
          mlfNUimenu(
            1,
            mainWindow,
            mxCreateString("Label"),
            mxCreateString("&File"),
            NULL));
        /*
         * uimenu(mainWindow,...
         * 'Label', '&File'...
         * );
         * open = ... % Sub-menu to open data files
         */
        mlfAssign(
          &open,
          mlfNUimenu(
            1,
            dataFile, mxCreateString("Label"), mxCreateString("&Open"), NULL));
        /*
         * uimenu(dataFile,...
         * 'Label', '&Open'...
         * );
         * % Option for Stanford ASCII format
         * % uimenu(open,...
         * %    'Label',    '&Stanford ASCII',...
         * %   'CallBack', 'Asufit(''openStanfAsc'')'...
         * %);
         * % Option for EXP format
         * uimenu(open,...
         */
        mclAssignAns(
          &ans,
          mlfNUimenu(
            0,
            open,
            mxCreateString("Label"),
            mxCreateString("&Exp"),
            mxCreateString("CallBack"),
            mxCreateString("Asufit('openExpFile')"),
            NULL));
        /*
         * 'Label',    '&Exp',...
         * 'CallBack', 'Asufit(''openExpFile'')'...
         * );
         * % Option for SPC/IRF format
         * uimenu(open,...
         */
        mclAssignAns(
          &ans,
          mlfNUimenu(
            0,
            open,
            mxCreateString("Label"),
            mxCreateString("&SPC/IRF files"),
            mxCreateString("CallBack"),
            mxCreateString("Asufit('openSpc')"),
            NULL));
        /*
         * 'Label',    '&SPC/IRF files',...
         * 'CallBack', 'Asufit(''openSpc'')'...
         * );
         * saveas = ... % Sub-menu to save data to files
         */
        mlfAssign(
          &saveas,
          mlfNUimenu(
            1,
            dataFile, mxCreateString("Label"), mxCreateString("&Save"), NULL));
        /*
         * uimenu(dataFile,...
         * 'Label', '&Save'...
         * );    

⌨️ 快捷键说明

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