필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Simon
Simon 2013년 11월 25일
편집: Matthew Coile 2023년 6월 15일
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
Simon
Simon 2013년 11월 26일
Hi Carla, Thank you very much for your help.
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에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by