📄 frac_tree_p.cpp
字号:
//
// MATLAB Compiler: 2.0
// Date: Tue Apr 18 10:30:35 2000
// Arguments: "-p" "frac_tree_p.m"
//
#include "frac_tree_p.hpp"
//
// The function "Mfrac_tree_p" is the implementation version of the
// "frac_tree_p" M-function from file
// "C:\Xue.Dy\BOOKS\MATLAB\mat5progs\mat5files\frac_tree_p.m" (lines 1-15). 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 frac_tree_s()
//
static void Mfrac_tree_p() {
mwArray N(mclGetUninitializedArray());
mwArray i(mclGetUninitializedArray());
mwForLoopIterator iterator_0;
mwArray v(mclGetUninitializedArray());
mwArray vv(mclGetUninitializedArray());
mwArray x(mclGetUninitializedArray());
mwArray x0(mclGetUninitializedArray());
mwArray y(mclGetUninitializedArray());
mwArray y0(mclGetUninitializedArray());
//
// x0=0; y0=0; N=1000000; v=rand(N,1);
//
x0 = 0.0;
y0 = 0.0;
N = 1000000.0;
v = rand_func(mwVarargin(N, 1.0));
//
// x=[x0; zeros(N-1,1)]; y=[y0; zeros(N-1,1)];
//
x
= vertcat(
mwVarargin(
horzcat(mwVarargin(x0)),
horzcat(mwVarargin(zeros(mwVarargin(N - mwArray(1.0), 1.0))))));
y
= vertcat(
mwVarargin(
horzcat(mwVarargin(y0)),
horzcat(mwVarargin(zeros(mwVarargin(N - mwArray(1.0), 1.0))))));
//
// for i=2:N
//
for (iterator_0.Start(2.0, N, mwArray::DIN); iterator_0.Next(&i); ) {
//
// vv=v(i);
//
vv = v(i);
//
// if vv<0.05, y(i)=0.5*y(i-1);
//
if (tobool(vv < mwArray(0.05))) {
y(i) = mwArray(0.5) * y(i - mwArray(1.0));
//
// elseif vv<0.45,
//
} else if (tobool(vv < mwArray(0.45))) {
//
// x(i)=0.42*(x(i-1)-y(i-1)); y(i)=0.2+0.42*(x(i-1)+y(i-1));
//
x(i) = mwArray(0.42) * (x(i - mwArray(1.0)) - y(i - mwArray(1.0)));
y(i)
= mwArray(0.2)
+ mwArray(0.42) * (x(i - mwArray(1.0)) + y(i - mwArray(1.0)));
//
// elseif vv<0.85,
//
} else if (tobool(vv < mwArray(0.85))) {
//
// x(i)=0.42*(x(i-1)+y(i-1)); y(i)=0.2-0.42*(x(i-1)-y(i-1));
//
x(i) = mwArray(0.42) * (x(i - mwArray(1.0)) + y(i - mwArray(1.0)));
y(i)
= mwArray(0.2)
- mwArray(0.42) * (x(i - mwArray(1.0)) - y(i - mwArray(1.0)));
//
// else,
//
} else {
//
// x(i)=0.1*x(i-1); y(i)=0.1*y(i-1)+0.2;
//
x(i) = mwArray(0.1) * x(i - mwArray(1.0));
y(i) = mwArray(0.1) * y(i - mwArray(1.0)) + mwArray(0.2);
//
// end
//
}
//
// end
//
}
}
//
// The function "frac_tree_p" contains the normal interface for the
// "frac_tree_p" M-function from file
// "C:\Xue.Dy\BOOKS\MATLAB\mat5progs\mat5files\frac_tree_p.m" (lines 1-15).
// This function processes any input arguments and passes them to the
// implementation version of the function, appearing above.
//
void frac_tree_p() {
Mfrac_tree_p();
}
//
// The function "mlxFrac_tree_p" contains the feval interface for the
// "frac_tree_p" M-function from file
// "C:\Xue.Dy\BOOKS\MATLAB\mat5progs\mat5files\frac_tree_p.m" (lines 1-15). The
// feval function calls the implementation version of frac_tree_p through this
// function. This function processes any input arguments and passes them to the
// implementation version of the function, appearing above.
//
void mlxFrac_tree_p(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
MW_BEGIN_MLX();
{
if (nlhs > 0) {
error(
"Run-time Error: File: frac_tree_p Line: 1 Column"
": 0 The function \"frac_tree_p\" was called with"
" more than the declared number of outputs (0)");
}
if (nrhs > 0) {
error(
"Run-time Error: File: frac_tree_p Line: 1 Column"
": 0 The function \"frac_tree_p\" was called with"
" more than the declared number of inputs (0)");
}
Mfrac_tree_p();
}
MW_END_MLX();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -