I am trying to simulate a time series process using Matlab. For example, let's see the following example:
http://www.mathworks.com/help/econ/arima.print.html
When I run following code
model = arima(1,0,1);
[fit,VarCov] = estimate(model,Y,'print',false);
I get the following error:
??? Undefined function or method 'arima' for input arguments of type 'double'.
Does Matlab contain functions for Matlab? Can I calculate different functions,like calculate autocorrelation or autocovariance at different lag? Or estimate ARMA parameters?
You need to make sure that you have a license and code for the Econometrics Toolbox before using that function. MATLAB has annoying license requirements for both the main software and its various toolboxes :(
But, you may be able to find some public code that can do the same thing. Check out http://www.mathtools.net/
Related
Is is possible to use the model simulated in the Simbiology toolbox of Matlab
to be used to implement fmincon for the same by calling the model from Simbiology?
It is possible to simulate the SimBiology model from a MATLAB script or the command line (see sbiosimulate). This allows the simulation results to be used by any other MATLAB function as needed. I assume that in your case you want to use the simulation results to construct an objective function to use with fmincon and it is possible. Let me know if you need more details.
The short answer is probably, yes. If you have access to the tools and try this, let me know and we can help further.
I know there are several functions, such as aryule and arborg, which can estimate coefficients of AR models. But these functions cannot deal with AR models with input-output delay.
I also learned that the newest Matlab includes a function named 'arx' that can estimate AR parameters including the input-output delay. Unfortunately, the current version of Matlab I used is 2013a and I didn't find this 'arx' function inside.
I am wondering if anybody would kindly help me to tackle this issue.
I am trying to construct a decision tree. I tried using the fitctree function and wrote:
ctree = fitctree(TrainingX,TrainingY);
such that TrainingX is the input matrix and TrainingY is the target matrix. An error appears saying that:
Undefined function 'fitctree' for input arguments of type 'double'.
I don't know what is the problem and what should I do to solve it. Could you please help me?
The reason why it is undefined is because fitctree requires the Statistics Toolbox in MATLAB. If you don't have the Statistics Toolbox, you can't use this function and you're SOL. Sorry!
Even with the Statistics Toolbox, fitctree is only available for recent editions of MATLAB (R2014a+). Check the release notes on the Statistics Toolbox for more details: http://www.mathworks.com/help/stats/release-notes.html. Go to where R2014a is and fully expand out all of the facts by clicking on Expand All. Where you see "Functions for classification methods and clustering", you'll see an entry for fitctree there.
The only option would be to upgrade your version of MATLAB to at least R2014a or above.
Good luck!
I am trying to run a code which calls the function OLS. reg=ols(y,X). I am getting an error saying that ols is an undefined function for input of type double. Is ols a function in the econometrics toolbox or do we create a separate ols function? I have checked the working directory and the toolbox is added to the path. I don't know what the problem is.
I don't have ols either and I have the econometrics toolbox. I'm guessing you are looking for some functions in File Exchange, most likely the Toolkit on Econometrics and Economics Teaching.
Simulink has a module called "Matlab Function," which allows you to create a custom function in a Simulink flow diagram.
I implemented a simple function in a Simulink Matlab Function module. My function contains a call to Matlab's built-in rms(). When I run the Simulink model, I get the following error:
The function 'rms' not supported for standalone code generation
If I remove rms from my Matlab Function in the Simulink model, the error goes away and the model runs flawlessly.
Questions:
Is there a way to use Matlab's rms in Simulink?
Are there many other native Matlab calls that can't be used inside Simulink?
I just wanted to clarify and expand upon some points made in learnvst's answer.
Even if you are simply trying to simulate a model containing a MATLAB Function block and are not explicitly attempting to perform code generation, you will still get the not supported for standalone code generation error.
As learnvst indicated, there are multiple restrictions on functions that can be used with code generation. However, if you just want to simulate your model, Simulink allows you to do this if you signify these "black-listed" functions as being extrinsic. This lets Simulink know that the functions will be used for simulation purposes only and won't be part of code generation.
In your particular case, add the following line of code somewhere before your call to rms:
coder.extrinsic('rms');
Declaring a function as extrinsic in a MATLAB Function is often useful even when you are performing code generation. For example, you may want to visualize your data using the plot command during simulation, but obviously would not need the plot command to be part of generated code.
Refer to this doc for more info on declaring functions to be extrinsic.
The not supported for standalone code generation part of the error suggests to me that you are trying to use a product like Matlab Coder to make an executable or native code. If this is the case, there are many naive calls that cannot be used directly in both core Matlab and the toolboxes. The coder products only support a subset of the language. More information can be found here . . .
http://www.mathworks.co.uk/products/matlab-coder/description2.html
As for your call to rms, it is only calculating the root of the mean of the squares. Try creating an alternative using something like . . .
sqrt(mean(x.^2))
...where x is the signal.