lti.evalfr and sys._evalfr have different behavior
See original GitHub issueThe evalfr function in the lti module expects a complex number and evaluates the system at that complex frequency. The method sys._evalfr, on the other hand, where sys is a transfer function or state space system, expects a real argument and multiplies it by j before evaluating the frequency response.
Is this dichotomy intentional?
- matlab’s
evalfrfunction expects a complex number, which seems like a more general-purpose solution.sys.freqrespexpects real-valued omega arguments, making it perhaps a better interface for users - also, right now, only
sys._evalfrcorrectly performs the z-plane transformation for discrete-time systems.
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Evaluate system response at specific frequency - MATLAB evalfr
State-space model with 3 outputs, 3 inputs, and 3 states. Compute the frequency response of the system at 0.2 rad/second. Since sys is...
Read more >master's thesis - DiVA
The complexity of multivariable systems, mainly the interactions between its elements, make it more difficult to deal with them than with scalar systems...
Read more >Python Control Library Documentation
Linear time invariant (LTI) systems are represented in python-control in state space, transfer function, or frequency.
Read more >Control System Toolbox User's Guide - UET Taxila
LTI Arrays of SS Models with Differing Numbers of States 4-23 ... frsp = evalfr(sys,f) evaluates the transfer function of the TF, SS,...
Read more >Creation of linear time-invariant Models (LTI-Models)
Transfer behaviour. • Rational expression of Laplace variable s: ... LTI–Models are cell arrays with predefined model pro- ... frsp = evalfr(sys,f).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

a
__call__method makes a lot of sense to me. It always struck me as odd how hard it is in matlab to find the frequency response of a transfer function – I didn’t know about evalfr until very recently.Presumably a change moving
evalfrto the matlab module and changingfreqresptofrequency_responsewould entail a version or two in which those were wrappers accompanied by deprecation warnings?We definitely need to remove the inconsistency, but I would encourage us to think more broadly and use a more Pythonic approach:
We can override the
__call__function so thatP(s)will represent the “value” of a transfer function at a complex values. This can replace theevalfrfunction. It should work for all LTI classes (including transfer functions, state space systems, FRD systems).We can provide a class method
frequency_responsethat takes a variety in input arguments representing a single frequency or list of frequencies. We could shorten this tofreqresp, but I think that using the longer name is more consistent with other usage. We could also provide an “alias” forfreqresp(both as a function and as a method?).We can use the MATLAB compatibility module to provide functions that match MATLAB’s standard usage, but I don’t think we need to represent those in the main
python-controlmodule.It would be great to get thoughts from others.