Skip to content

control.matlab.freqresp is inconsistent with MATLAB #573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
murrayrm opened this issue Mar 15, 2021 · 4 comments
Open

control.matlab.freqresp is inconsistent with MATLAB #573

murrayrm opened this issue Mar 15, 2021 · 4 comments

Comments

@murrayrm
Copy link
Member

murrayrm commented Mar 15, 2021

As pointed out in issue #550, the freqresp function returns magnitude, phase, and frequency instead of the complex frequency response. This is OK for the main package (since you can just evaluate the system itself to get the complex frequency response), but it is inconsistent with MATLAB's freqresp function. At the least, control.matlab.freqresp should be consistent with MATLAB.

See discussion in PR #449 and issue #434.

@murrayrm murrayrm changed the title control.matlab.freqresp is inconsistent with MATLAB control.matlab.freqresp is missing in 0.9.0 Mar 16, 2021
@sawyerbfuller
Copy link
Contributor

Looking through the code, it looks like the freqresp function, which is in the lti module, gets imported correctly in the matlab module. (Am not at my computer so haven’t tested this yet). The sys.freqresp method, on the other hand, is deprecated in favor ofsys.frequency_response. So I think the problem might only be that it returns the results in the wrong form (mag and phase rather than complex).

@murrayrm
Copy link
Member Author

Agh. I must have been looking at some different version. I think the problem is not that the function is missing, but that it is inconsistent with MATLAB. Re-editing title and description. Sorry for the confusion.

@murrayrm murrayrm changed the title control.matlab.freqresp is missing in 0.9.0 control.matlab.freqresp is inconsistent with MATLAB Mar 16, 2021
@JinmingChe
Copy link

Hi, I update the control to version 0.9.0. LTI system can be callable. But I want to caculate the freqresp of a FRD system to get the complex frequency response. If there any solution?

@murrayrm
Copy link
Member Author

murrayrm commented Mar 24, 2021

Use H(omega*1j) or H.eval(omega) where H is an FRD function. If you want to evaluate at frequencies other than those that define the frequency response, you need to create a smooth FRD object (use frd(d, w, smooth=True)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants