Revision 706, 0.9 kB
(checked in by smidl, 15 years ago)
|
eol-native
|
-
Property svn:eol-style set to
native
|
Line | |
---|
1 | #include <itpp/itmex.h> |
---|
2 | #include <estim/arx.h> |
---|
3 | |
---|
4 | using namespace bdm; |
---|
5 | |
---|
6 | void mexFunction(int n_output, mxArray *output[], int n_input, const mxArray *input[]) |
---|
7 | { |
---|
8 | // Check the number of inputs and output arguments |
---|
9 | if(n_output!=1) mexErrMsgTxt("Wrong number of output variables!"); |
---|
10 | if(n_input!=2) mexErrMsgTxt("Usage: arx1d(ysize, Data)!"); |
---|
11 | |
---|
12 | // Convert input variables to IT++ format |
---|
13 | int ysize = mxArray2int(input[0]); |
---|
14 | mat Data = mxArray2mat(input[1]); |
---|
15 | |
---|
16 | // ------------------ Start of routine --------------------------- |
---|
17 | ARX Ar; |
---|
18 | Ar.set_statistics(ysize, 1e-5*eye(Data.rows()) ); |
---|
19 | Ar.bayes_batch(Data); |
---|
20 | // ------------------ End of routine ----------------------------- |
---|
21 | |
---|
22 | // Create output vectors |
---|
23 | output[0] = mxCreateDoubleMatrix(1,Data.rows(), mxREAL); |
---|
24 | |
---|
25 | // Convert the IT++ format to Matlab format for output |
---|
26 | vec2mxArray(Ar.posterior().mean(), output[0]); |
---|
27 | } |
---|