From: Ryan K. <rk...@si...> - 2013-06-06 19:32:02
|
FYI, I made this change in my local checkout code and ran a simple test and it is working: In [8]: test = control.TransferFunction(1,[1,3]) In [9]: s1 = -1+2.0j In [10]: test(s1) Out[10]: (0.25-0.25j) In [11]: 1.0/(s1+3) Out[11]: (0.25-0.25j) Nothing too fancy, but solves my issue. -- Ryan Krauss, Ph.D. Associate Professor Mechanical Engineering Southern Illinois University Edwardsville On Thu, Jun 6, 2013 at 1:47 PM, Ryan Krauss <rk...@si...> wrote: > I would like to submit some minor patches over the course of the summer to > help me completely get rid of my old controls module and switch over to > python-control for everything. My most immediate need is for a __call__ > method. This method might not make any sense for a state-space system, but > for certain aspects of my modeling work, I need to evaluate transfer > functions at certain numerical values of s. > > I would propose something like this: > > def __call__(self, s): > """Evaluate a transfer function at s.""" > N_poly = poly1d(squeeze(self.num)) > D_poly = poly1d(squeeze(self.den)) > return N_poly(s)/D_poly(s) > > > It could also include a check that self is SISO and possibly throw an > exception if it is not (pretty sure that poly1d will throw one if we pass > in a vector of coefficients that isn't 1d). > > Would this be welcome? Is there anything I should tweak? > > Thanks, > > Ryan > > -- > Ryan Krauss, Ph.D. > Associate Professor > Mechanical Engineering > Southern Illinois University Edwardsville > |