📄 ploterr.c
字号:
}
mlfEnterNewContext(0, 3, mprhs[0], mprhs[1], mprhs[2]);
mplhs[0] = Mploterr(nlhs, mprhs[0], mprhs[1], mprhs[2]);
mlfRestorePreviousContext(0, 3, mprhs[0], mprhs[1], mprhs[2]);
plhs[0] = mplhs[0];
}
/*
* The function "Mploterr" is the implementation version of the "ploterr"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\ploterr.m" (lines
* 1-66). 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 h2=ploterr(e,g,h)
*/
static mxArray * Mploterr(int nargout_, mxArray * e, mxArray * g, mxArray * h) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_ploterr);
int nargin_ = mclNargin(3, e, g, h, NULL);
mxArray * h2 = NULL;
mxArray * H = NULL;
mxArray * nargin2 = NULL;
mxArray * t = NULL;
mxArray * epochs = NULL;
mxArray * ans = NULL;
mclCopyArray(&e);
mclCopyArray(&g);
mclCopyArray(&h);
/*
* %PLOTERR Plot network sum-squared error vs epochs.
* %
* % This function is obselete.
*
* nntobsf('barerr','Use BAR to make bar plots.')
*/
mlfNntobsf(_mxarray0_, _mxarray2_, NULL);
/*
*
* % PLOTERR(E,G)
* % E - Row vector of error values.
* % G - Error goal.
* % Returns (optionally) handle to error curve in plot.
* %
* % PLOTERR(E,G,H)
* % H - Handle returned by previous call to PLOTERR.
* % Deletes old error curve H, and plots new one.
*
* % Mark Beale, 1-31-92
* % Revised 12-15-93, MB
* % Copyright 1992-2002 The MathWorks, Inc.
* % $Revision: 1.12 $
*
* if nargin < 1,error('Not enough arguments'), end
*/
if (nargin_ < 1) {
mlfError(_mxarray4_, NULL);
}
/*
*
* epochs = length(e)-1;
*/
mlfAssign(&epochs, mlfScalar(mclLengthInt(mclVa(e, "e")) - 1));
/*
* t = sprintf('Sum-Squared Network Error for %g Epochs',epochs);
*/
mlfAssign(&t, mlfSprintf(NULL, _mxarray6_, mclVv(epochs, "epochs"), NULL));
/*
*
* % BACKWARD COMPATIBILITY FOR NNT 1.0
* % Convert PLOTERR(E,T) -> PLOTERR(E)
* nargin2 = nargin;
*/
mlfAssign(&nargin2, mlfScalar(nargin_));
/*
* if nargin2 == 2
*/
if (mclEqBool(mclVv(nargin2, "nargin2"), _mxarray8_)) {
/*
* if isstr(g)
*/
if (mlfTobool(mlfIsstr(mclVa(g, "g")))) {
/*
* t = g;
*/
mlfAssign(&t, mclVa(g, "g"));
/*
* nargin2 = 1;
*/
mlfAssign(&nargin2, _mxarray9_);
/*
* end
*/
}
/*
* end
*/
}
/*
*
* if nargin2 < 3
*/
if (mclLtBool(mclVv(nargin2, "nargin2"), _mxarray10_)) {
/*
* newplot;
*/
mclAssignAns(&ans, mlfNNewplot(0, NULL));
/*
* delete(get(gca,'children'))
*/
mlfDelete(mlfNGet(1, mlfGca(NULL), _mxarray11_, NULL), NULL);
/*
* if nargin2 == 2
*/
if (mclEqBool(mclVv(nargin2, "nargin2"), _mxarray8_)) {
/*
* plot([0 999999],[g g],'r:',0,g*0.9,'.b')
*/
mclPrintAns(
&ans,
mlfNPlot(
0,
_mxarray13_,
mlfHorzcat(mclVa(g, "g"), mclVa(g, "g"), NULL),
_mxarray15_,
_mxarray17_,
mclMtimes(mclVa(g, "g"), _mxarray18_),
_mxarray19_,
NULL));
/*
* end
*/
}
/*
* xlabel('Epoch')
*/
mclPrintAns(&ans, mlfNXlabel(0, _mxarray21_, NULL));
/*
* ylabel('Sum-Squared Error')
*/
mclPrintAns(&ans, mlfNYlabel(0, _mxarray23_, NULL));
/*
* title(t)
*/
mclPrintAns(&ans, mlfNTitle(0, mclVv(t, "t"), NULL));
/*
* set(gca,'box','on')
*/
mclPrintAns(
&ans, mlfNSet(0, mlfGca(NULL), _mxarray25_, _mxarray27_, NULL));
/*
* else
*/
} else {
/*
* delete(h);
*/
mlfDelete(mclVa(h, "h"), NULL);
/*
* end
*/
}
/*
*
* hold on
*/
mlfHold(_mxarray27_);
/*
* e = e + eps;
*/
mlfAssign(&e, mclPlus(mclVa(e, "e"), _mxarray29_));
/*
* H = plot(0:epochs,e);
*/
mlfAssign(
&H,
mlfNPlot(
1,
mlfColon(_mxarray17_, mclVv(epochs, "epochs"), NULL),
mclVa(e, "e"),
NULL));
/*
* title(t)
*/
mclPrintAns(&ans, mlfNTitle(0, mclVv(t, "t"), NULL));
/*
* hold off
*/
mlfHold(_mxarray30_);
/*
*
* set(gca,'xlim',[0 epochs+eps]);
*/
mclAssignAns(
&ans,
mlfNSet(
0,
mlfGca(NULL),
_mxarray32_,
mlfHorzcat(
_mxarray17_, mclPlus(mclVv(epochs, "epochs"), _mxarray29_), NULL),
NULL));
/*
* set(gca,'ylim',[0 1]);
*/
mclAssignAns(
&ans, mlfNSet(0, mlfGca(NULL), _mxarray34_, _mxarray36_, NULL));
/*
* set(gca,'ylimmode','auto')
*/
mclPrintAns(&ans, mlfNSet(0, mlfGca(NULL), _mxarray38_, _mxarray40_, NULL));
/*
* set(gca,'yscale','log');
*/
mclAssignAns(
&ans, mlfNSet(0, mlfGca(NULL), _mxarray42_, _mxarray44_, NULL));
/*
* drawnow
*/
mlfDrawnow(NULL);
/*
*
* if nargout == 1
*/
if (nargout_ == 1) {
/*
* h2 = H;
*/
mlfAssign(&h2, mclVv(H, "H"));
/*
* end
*/
}
mclValidateOutput(h2, 1, nargout_, "h2", "ploterr");
mxDestroyArray(ans);
mxDestroyArray(epochs);
mxDestroyArray(t);
mxDestroyArray(nargin2);
mxDestroyArray(H);
mxDestroyArray(h);
mxDestroyArray(g);
mxDestroyArray(e);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return h2;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -