1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Steady-State to Transfer Function Using MATLAB

  1. Nov 28, 2011 #1
    I am trying to use MATLAB to obtain a transfer function, for my Controls class. I will be honest, I have no experience using MATLAB, but our professor insists on us using it to find the transfer function. MATLAB is not a prerequisite for this class. Before I start attempt to find my transfer function, I wanted to make sure I can run the function first. I am having trouble using it. Below is my code that I have on my .m file.

    Code (Text):
    A=[0 500; -3.3333 -33.3333]
    B=[0; 3.3333]
    C=[1 0]

    When I run this .m file, I get the following error:

    Code (Text):
    ??? Attempt to execute SCRIPT ss2tf as a function.

    Error in ==> ss2tf at 6
    Can anyone help an inexperienced MATLAB user?
  2. jcsd
  3. Nov 29, 2011 #2
    You can't name your .m file with a name that is reserved for a Matlab function (in this case ss2tf). So rename your .m file something other than ss2tf.m and it should work fine.

    Unfortunately Matlab doesn't do any checking or enforcement of this other than giving you a vague error like that. But what is happening is that when it gets to the ss2tf function call in your .m file it is confused as to whether you want to call the .m file again or the Matlab function since they both have the same name.
  4. Dec 3, 2011 #3
    Apparently, this command doesn't work with my version of MATLAB. I have an older version, and I tried this on MATLAB 2010 and it works just fine.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook