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

3 Ansichten (letzte 30 Tage)
Simon
Simon am 25 Nov. 2013
Bearbeitet: Matthew Coile am 15 Jun. 2023
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

Akzeptierte Antwort

Carla
Carla am 25 Nov. 2013
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 Kommentare
Simon
Simon am 26 Nov. 2013
Hi Carla, Thank you very much for your help.
Matthew Coile
Matthew Coile am 15 Jun. 2023
Bearbeitet: Matthew Coile am 15 Jun. 2023
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu System Identification Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by