How do I specify which toolbox a function should be used from?

3 次查看(过去 30 天)
Hi there,
I am trying to use the "freqresp" function from the RF toolbox to calculate the response of a RFmodel object. However, I have realise that "freqresp" could come from RF toolbox as well as the Control toolbox. My questions are:
1. Will MatLab knows which is the correct one to be used for my script? 2. How can I find out which one is actually being used? 3. Can I specify in my script which toolbox will need to be used before the line of code that has "freqresp", and then switch back to whatever default path order of the toolbox I have in the installation. (FYI: my default path order has Control toolbox before RF toobox)? 4. When using "freqresp", should be input freq vector in Hz or rad/s? 5. "rationfit" in RF toolbox seems to require freq in Hz. Is it correct? The help menu is not clear to me.
Thank you for your help in advance, Simon

采纳的回答

Carla
Carla 2013-11-25
MATLAB determines which freqresp to use based upon what type of input you give it. The first argument to the Control System Toolbox freqresp must be a dynamic system model like a tf, ss, etc. - one of the classes of model objects in Control System Toolbox. The first argument to the RF Toolbox freqresp is a rational function object, a class of model objects in RF Toolbox. If both freqresp commands are on your path, MATLAB finds the one that can operate on the type of input you've given.
I just tested this with a MATLAB installation that has both RF Toolbox and Control System Toolbox, and it "just worked" - when I gave it an RF model, it used RFTB's freqresp, and when I gave it an ss model, it used CSTB's freqresp.
  2 个评论
Matthew Coile
Matthew Coile 2023-6-15
编辑:Matthew Coile 2023-6-15
Ten years on, this was not the case for me. I needed to use a function which is both the "statistics and machine learning toolbox" as well as a third party toolbox, "PLS toolbox". The PLS toolbox pca function defined in pca.m requires two input arguments, while the pca function in the statistics toolbox requires only one (and throws an error if you give 2). Just switching the argument did not work for me. Instead, I found I had to use "cd [path to toolbox folder containing the m file]" right before calling the pca function in order to specify which to use. Otherwise MATLAB just used one or the other automatically and threw an error if it was finding the "wrong" function on its path first.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 System Identification Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by