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

📄 surf.c

📁 ASUFIT-Matlab-全局拟合程序
💻 C
字号:
/*
 * MATLAB Compiler: 2.0.1
 * Date: Tue May 08 21:28:21 2001
 * Arguments: "-B" "sgl" "-m" "-W" "mainhg" "-L" "C" "asufit.m" "absfun.m"
 * "absfunfree.m" "absfunshift.m" "absfunwidth.m" "dispfit.m" "dispfitdisp.m"
 * "dispfitfree.m" "dispfitwidth.m" "seqmodfree.m" "spcfun.m" "spcfun1.m"
 * "atamult.m" "aprecon.m" 
 */
#include "surf.h"
#include "grid.h"

/*
 * The function "Msurf" is the implementation version of the "surf" M-function
 * from file "C:\MATLABR11\toolbox\matlab\graph3d\surf.m" (lines 1-69). It
 * contains the actual compiled code for that M-function. It is a static
 * function and must only be called from one of the interface functions,
 * appearing below.
 */
/*
 * function h = surf(varargin)
 */
static mxArray * Msurf(int nargout_, mxArray * varargin) {
    mxArray * h = mclGetUninitializedArray();
    mxArray * ans = mclInitializeAns();
    mxArray * cax = mclGetUninitializedArray();
    mxArray * hh = mclGetUninitializedArray();
    mxArray * nargin_ = mclGetUninitializedArray();
    mxArray * nargout = mclInitialize(mlfScalar(nargout_));
    mxArray * next = mclGetUninitializedArray();
    mlfAssign(&nargin_, mlfNargin(1, varargin, NULL));
    /*
     * %SURF   3-D colored surface.
     * %   SURF(X,Y,Z,C) plots the colored parametric surface defined by
     * %   four matrix arguments.  The view point is specified by VIEW.
     * %   The axis labels are determined by the range of X, Y and Z,
     * %   or by the current setting of AXIS.  The color scaling is determined
     * %   by the range of C, or by the current setting of CAXIS.  The scaled
     * %   color values are used as indices into the current COLORMAP.
     * %   The shading model is set by SHADING.
     * %
     * %   SURF(X,Y,Z) uses C = Z, so color is proportional to surface height.
     * %
     * %   SURF(x,y,Z) and SURF(x,y,Z,C), with two vector arguments replacing
     * %   the first two matrix arguments, must have length(x) = n and
     * %   length(y) = m where [m,n] = size(Z).  In this case, the vertices
     * %   of the surface patches are the triples (x(j), y(i), Z(i,j)).
     * %   Note that x corresponds to the columns of Z and y corresponds to
     * %   the rows.
     * %
     * %   SURF(Z) and SURF(Z,C) use x = 1:n and y = 1:m.  In this case,
     * %   the height, Z, is a single-valued function, defined over a
     * %   geometrically rectangular grid.
     * %
     * %   SURF(...,'PropertyName',PropertyValue,...) sets the value of the 
     * %   specified surface property.  Multiple property values can be set
     * %   with a single statement.
     * %
     * %   SURF returns a handle to a SURFACE object.
     * %
     * %   AXIS, CAXIS, COLORMAP, HOLD, SHADING and VIEW set figure, axes, and 
     * %   surface properties which affect the display of the surface.
     * %
     * %   See also SURFC, SURFL, MESH, SHADING.
     * 
     * %-------------------------------
     * %   Additional details:
     * %
     * %   If the NextPlot axis property is REPLACE (HOLD is off), SURF resets 
     * %   all axis properties, except Position, to their default values
     * %   and deletes all axis children (line, patch, surf, image, and 
     * %   text objects).
     * 
     * %   Copyright (c) 1984-98 by The MathWorks, Inc.
     * %   $Revision: 5.9 $  $Date: 1998/05/11 19:12:11 $
     * 
     * %   J.N. Little 1-5-92
     * 
     * cax = newplot;
     */
    mlfAssign(&cax, mlfNNewplot(1, NULL));
    /*
     * 
     * if nargin == 0
     */
    if (mlfTobool(mlfEq(nargin_, mlfScalar(0.0)))) {
        /*
         * error('Not enough input arguments.')
         */
        mlfError(mxCreateString("Not enough input arguments."));
    /*
     * elseif nargin == 1
     */
    } else if (mlfTobool(mlfEq(nargin_, mlfScalar(1.0)))) {
        /*
         * if min( size( varargin{1} ) ) == 1
         */
        if (mlfTobool(
              mlfEq(
                mlfMin(
                  NULL,
                  mlfFeval(
                    mclValueVarargout(),
                    mlxSize,
                    mlfIndexRef(varargin, "{?}", mlfScalar(1.0)),
                    NULL),
                  NULL,
                  NULL),
                mlfScalar(1.0)))) {
            /*
             * error('Input argument must be a matrix not a vector or a scalar')
             */
            mlfError(
              mxCreateString(
                "Input argument must be a matrix not a vector or a scalar"));
        /*
         * else
         */
        } else {
            /*
             * hh = surface(varargin{1});
             */
            mlfAssign(
              &hh,
              mlfNSurface(
                1, mlfIndexRef(varargin, "{?}", mlfScalar(1.0)), NULL));
        /*
         * end
         */
        }
    /*
     * else
     */
    } else {
        /*
         * hh = surface(varargin{:});
         */
        mlfAssign(
          &hh,
          mlfNSurface(
            1, mlfIndexRef(varargin, "{?}", mlfCreateColonIndex()), NULL));
    /*
     * end
     */
    }
    /*
     * 
     * next = lower(get(cax,'NextPlot'));
     */
    mlfAssign(&next, mlfLower(mlfGet(cax, mxCreateString("NextPlot"), NULL)));
    /*
     * if ~ishold
     */
    if (mlfTobool(mlfNot(mlfIshold()))) {
        /*
         * view(3); grid on
         */
        mclAssignAns(&ans, mlfNView(0, NULL, mlfScalar(3.0), NULL));
        mlfGrid(mxCreateString("on"));
    /*
     * end
     */
    }
    /*
     * if nargout == 1
     */
    if (mlfTobool(mlfEq(nargout, mlfScalar(1.0)))) {
        /*
         * h = hh;
         */
        mlfAssign(&h, hh);
    /*
     * end
     */
    }
    mclValidateOutputs("surf", 1, nargout_, &h);
    mxDestroyArray(ans);
    mxDestroyArray(cax);
    mxDestroyArray(hh);
    mxDestroyArray(nargin_);
    mxDestroyArray(nargout);
    mxDestroyArray(next);
    return h;
}

/*
 * The function "mlfNSurf" contains the nargout interface for the "surf"
 * M-function from file "C:\MATLABR11\toolbox\matlab\graph3d\surf.m" (lines
 * 1-69). This interface is only produced if the M-function uses the special
 * variable "nargout". The nargout interface allows the number of requested
 * outputs to be specified via the nargout argument, as opposed to the normal
 * interface which dynamically calculates the number of outputs based on the
 * number of non-NULL inputs it receives. This function processes any input
 * arguments and passes them to the implementation version of the function,
 * appearing above.
 */
mxArray * mlfNSurf(int nargout, ...) {
    mxArray * varargin = mclUnassigned();
    mxArray * h = mclGetUninitializedArray();
    mlfVarargin(&varargin, nargout, 0);
    mlfEnterNewContext(0, -1, varargin);
    h = Msurf(nargout, varargin);
    mlfRestorePreviousContext(0, 0);
    mxDestroyArray(varargin);
    return mlfReturnValue(h);
}

/*
 * The function "mlfSurf" contains the normal interface for the "surf"
 * M-function from file "C:\MATLABR11\toolbox\matlab\graph3d\surf.m" (lines
 * 1-69). This function processes any input arguments and passes them to the
 * implementation version of the function, appearing above.
 */
mxArray * mlfSurf(mxArray * synthetic_varargin_argument, ...) {
    mxArray * varargin = mclUnassigned();
    int nargout = 1;
    mxArray * h = mclGetUninitializedArray();
    mlfVarargin(&varargin, synthetic_varargin_argument, 1);
    mlfEnterNewContext(0, -1, varargin);
    h = Msurf(nargout, varargin);
    mlfRestorePreviousContext(0, 0);
    mxDestroyArray(varargin);
    return mlfReturnValue(h);
}

/*
 * The function "mlfVSurf" contains the void interface for the "surf"
 * M-function from file "C:\MATLABR11\toolbox\matlab\graph3d\surf.m" (lines
 * 1-69). The void interface is only produced if the M-function uses the
 * special variable "nargout", and has at least one output. The void interface
 * function specifies zero output arguments to the implementation version of
 * the function, and in the event that the implementation version still returns
 * an output (which, in MATLAB, would be assigned to the "ans" variable), it
 * deallocates the output. This function processes any input arguments and
 * passes them to the implementation version of the function, appearing above.
 */
void mlfVSurf(mxArray * synthetic_varargin_argument, ...) {
    mxArray * varargin = mclUnassigned();
    mxArray * h = mclUnassigned();
    mlfVarargin(&varargin, synthetic_varargin_argument, 1);
    mlfEnterNewContext(0, -1, varargin);
    h = Msurf(0, synthetic_varargin_argument);
    mlfRestorePreviousContext(0, 0);
    mxDestroyArray(varargin);
}

/*
 * The function "mlxSurf" contains the feval interface for the "surf"
 * M-function from file "C:\MATLABR11\toolbox\matlab\graph3d\surf.m" (lines
 * 1-69). The feval function calls the implementation version of surf through
 * this function. This function processes any input arguments and passes them
 * to the implementation version of the function, appearing above.
 */
void mlxSurf(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    mxArray * mprhs[1];
    mxArray * mplhs[1];
    int i;
    if (nlhs > 1) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: surf Line: 1 Column: 0 The function \"surf\""
            " was called with more than the declared number of outputs (1)"));
    }
    for (i = 0; i < 1; ++i) {
        mplhs[i] = NULL;
    }
    mlfEnterNewContext(0, 0);
    mprhs[0] = NULL;
    mlfAssign(&mprhs[0], mclCreateVararginCell(nrhs, prhs));
    mplhs[0] = Msurf(nlhs, mprhs[0]);
    mlfRestorePreviousContext(0, 0);
    plhs[0] = mplhs[0];
    mxDestroyArray(mprhs[0]);
}

⌨️ 快捷键说明

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