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

📄 surf.cpp

📁 该程序为MATLAB对CDMA系统个部分的仿真
💻 CPP
字号:
//
// MATLAB Compiler: 2.2
// Date: Tue Jun 25 10:54:12 2002
// Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
// "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
// "array_indexing:on" "-O" "optimize_conditionals:on" "-B" "sglcpp" "-p" "-W"
// "main" "-L" "Cpp" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-W" "mainhg"
// "libmwsglm.mlib" "exm110633_1" 
//
#include "surf.hpp"
#include "libmatlbm.hpp"
#include "libmmfile.hpp"

static mxChar _array1_[126] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
                                'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
                                'l', 'e', ':', ' ', 's', 'u', 'r', 'f', ' ',
                                'L', 'i', 'n', 'e', ':', ' ', '1', ' ', 'C',
                                'o', 'l', 'u', 'm', 'n', ':', ' ', '1', ' ',
                                'T', 'h', 'e', ' ', 'f', 'u', 'n', 'c', 't',
                                'i', 'o', 'n', ' ', '"', 's', 'u', 'r', 'f',
                                '"', ' ', 'w', 'a', 's', ' ', 'c', 'a', 'l',
                                'l', 'e', 'd', ' ', 'w', 'i', 't', 'h', ' ',
                                'm', 'o', 'r', 'e', ' ', 't', 'h', 'a', 'n',
                                ' ', 't', 'h', 'e', ' ', 'd', 'e', 'c', 'l',
                                'a', 'r', 'e', 'd', ' ', 'n', 'u', 'm', 'b',
                                'e', 'r', ' ', 'o', 'f', ' ', 'o', 'u', 't',
                                'p', 'u', 't', 's', ' ', '(', '1', ')', '.' };
static mwArray _mxarray0_ = mclInitializeString(126, _array1_);
static mwArray _mxarray2_ = mclInitializeDouble(1.0);
static double _ieee_plusinf_ = mclGetInf();
static mwArray _mxarray3_ = mclInitializeDouble(_ieee_plusinf_);
static mwArray _mxarray4_ = mclInitializeDoubleVector(0, 0, (double *)NULL);

static mxChar _array6_[6] = { 'p', 'a', 'r', 'e', 'n', 't' };
static mwArray _mxarray5_ = mclInitializeString(6, _array6_);
static mwArray _mxarray7_ = mclInitializeDouble(3.0);

static mxChar _array9_[2] = { 'o', 'n' };
static mwArray _mxarray8_ = mclInitializeString(2, _array9_);

void InitializeModule_surf() {
}

void TerminateModule_surf() {
}

static mwArray Msurf(int nargout_, mwArray varargin);

_mexLocalFunctionTable _local_function_table_surf
  = { 0, (mexFunctionTableEntry *)NULL };

//
// The function "Nsurf" contains the nargout interface for the "surf"
// M-function from file "d:\MATLAB6p1\toolbox\matlab\graph3d\surf.m" (lines
// 1-78). 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.
//
mwArray Nsurf(int nargout, mwVarargin varargin) {
    mwArray h(mclGetUninitializedArray());
    h = Msurf(nargout, varargin.ToArray());
    return h;
}

//
// The function "surf" contains the normal interface for the "surf" M-function
// from file "d:\MATLAB6p1\toolbox\matlab\graph3d\surf.m" (lines 1-78). This
// function processes any input arguments and passes them to the implementation
// version of the function, appearing above.
//
mwArray surf(mwVarargin varargin) {
    int nargout(1);
    mwArray h(mclGetUninitializedArray());
    h = Msurf(nargout, varargin.ToArray());
    return h;
}

//
// The function "Vsurf" contains the void interface for the "surf" M-function
// from file "d:\MATLAB6p1\toolbox\matlab\graph3d\surf.m" (lines 1-78). 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 Vsurf(mwVarargin varargin) {
    mwArray h(mwArray::UNDEFINED);
    h = Msurf(0, varargin.ToArray());
}

//
// The function "mlxSurf" contains the feval interface for the "surf"
// M-function from file "d:\MATLAB6p1\toolbox\matlab\graph3d\surf.m" (lines
// 1-78). 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[]) {
    MW_BEGIN_MLX();
    {
        mwArray mprhs[1];
        mwArray mplhs[1];
        mclCppUninitializeArrays(1, mplhs);
        if (nlhs > 1) {
            error(_mxarray0_);
        }
        mprhs[0] = mclCreateVararginCell(nrhs, prhs);
        mplhs[0] = Msurf(nlhs, mprhs[0]);
        plhs[0] = mplhs[0].FreezeData();
    }
    MW_END_MLX();
}

//
// The function "Msurf" is the implementation version of the "surf" M-function
// from file "d:\MATLAB6p1\toolbox\matlab\graph3d\surf.m" (lines 1-78). 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 mwArray Msurf(int nargout_, mwArray varargin) {
    mwLocalFunctionTable save_local_function_table_
      (&_local_function_table_surf);
    int nargin_(nargin(-1, mwVarargin(varargin)));
    mwArray h(mclGetUninitializedArray());
    mwArray hh(mclGetUninitializedArray());
    mwArray i(mclGetUninitializedArray());
    mwArray cax(mclGetUninitializedArray());
    mwArray ans(mclGetUninitializedArray());
    //
    // %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 1984-2001 The MathWorks, Inc. 
    // %   $Revision: 5.13 $  $Date: 2001/04/15 11:58:58 $
    // 
    // %   J.N. Little 1-5-92
    // 
    // error(nargchk(1,inf,nargin))
    //
    error(mwVe(nargchk(_mxarray2_, _mxarray3_, nargin_)));
    //
    // 
    // cax = [];
    //
    cax = _mxarray4_;
    //
    // 
    // 
    // if nargin > 1
    //
    if (nargin_ > 1) {
        //
        // % try to fetch axes handle from input args
        // for i = 1:length(varargin)
        //
        int v_(mclForIntStart(1));
        int e_(mclForIntEnd(mwArray(mclLengthInt(mwVa(varargin, "varargin")))));
        if (v_ > e_) {
            i = _mxarray4_;
        } else {
            //
            // if isstr(varargin{i}) & strncmpi(varargin{i}, 'parent', length(varargin{i})) & nargin > i
            // cax = varargin{i+1};
            // break;
            // end
            // end
            //
            for (; ; ) {
                mwArray a_
                  (mwVe(
                     feval(
                       mwValueVarargout(),
                       mlxIsstr,
                       mwVarargin(
                         mwVe(mwVsa(varargin, "varargin").cell(v_))))));
                if (tobool(a_)) {
                    a_
                      = a_
                        & mwVe(
                            feval(
                              mwValueVarargout(),
                              mlxStrncmpi,
                              mwVarargin(
                                mwVe(mwVsa(varargin, "varargin").cell(v_)),
                                _mxarray5_,
                                mwVe(
                                  feval(
                                    mwValueVarargout(),
                                    mlxLength,
                                    mwVarargin(
                                      mwVe(
                                        mwVsa(varargin, "varargin").cell(
                                          v_))))))));
                } else {
                    a_ = 0;
                }
                if (tobool(a_) && tobool(a_ & nargin_ > v_)) {
                    cax = mwVsa(varargin, "varargin").cell(v_ + 1);
                    break;
                } else {
                }
                if (v_ == e_) {
                    break;
                }
                ++v_;
            }
            i = v_;
        }
    //
    // end
    //
    }
    //
    // 
    // % use nextplot unless user specifed an axes handle
    // if isempty(cax)
    //
    if (tobool(mwVe(isempty(mwVv(cax, "cax"))))) {
        //
        // cax = newplot;
        //
        cax = Nnewplot(1, mwArray::DIN);
    //
    // end
    //
    }
    //
    // 
    // hh = surface(varargin{:});
    //
    hh
      = Nsurface(
          1, mwVarargin(mwVe(mwVsa(varargin, "varargin").cell(colon()))));
    //
    // 
    // if ~ishold(cax)
    //
    if (mclNotBool(mwVe(ishold(mwVv(cax, "cax"))))) {
        //
        // view(cax,3);
        //
        ans.EqAns(Nview(0, NULL, mwVv(cax, "cax"), _mxarray7_));
        //
        // grid(cax,'on');
        //
        grid(mwVv(cax, "cax"), _mxarray8_);
    //
    // end
    //
    }
    //
    // 
    // if nargout == 1
    //
    if (nargout_ == 1) {
        //
        // h = hh;
        //
        h = mwVsv(hh, "hh");
    //
    // end
    //
    }
    mwValidateOutput(h, 1, nargout_, "h", "surf");
    return h;
}

⌨️ 快捷键说明

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