unable to plot bode - phase with control package

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

unable to plot bode - phase with control package

R help mailing list-2
Dear All

I hope my question is relevant on this forum, else very sorry for the
disturbance

I want to simply plot a bode diagram of a siso model

using the 'bodeplot' command in the control package fail due to error in
'issiso' evaluation...

Error in if (issiso(sys)) {:

then I try by myself some retro-engineering :)

the problem is when I use

H <- freqresp(syst, w)
mag = 20*log10(abs(H))
phase <- atan2(Im(H), Re(H)) * 180/pi

if the order of the system is higher than 2 it is wrong (result will be
only between -pi / pi)

how to proceed ? for each evaluated point take a derivative and evaluate
the order to add the proper number of pi ?

Thanks for the help !

Best

Frédéric

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: unable to plot bode - phase with control package

Jeff Newmiller
a) What is so difficult about the idea that this list is about R, not theory? There do exist forums about control theory (e.g. engineering.stackexchange.com)

b) Using [-pi,+pi) is not "wrong"... it is numerically more precise, though it may not convey what you would prefer to convey.

c) The general case with poles and zeroes is more complicated than just adding the order of your system. Do a search on

"winding number" "bode"

But if by inspection you think that shortcut will work for your system then do what you need to.

d) If implementing a more general alternative solution is your itch, I am sure the maintainer of this _contributed package_ would welcome patches to add features.


On October 8, 2020 12:08:19 AM PDT, fr1d_mail via R-help <[hidden email]> wrote:

>Dear All
>
>I hope my question is relevant on this forum, else very sorry for the
>disturbance
>
>I want to simply plot a bode diagram of a siso model
>
>using the 'bodeplot' command in the control package fail due to error
>in
>'issiso' evaluation...
>
>Error in if (issiso(sys)) {:
>
>then I try by myself some retro-engineering :)
>
>the problem is when I use
>
>H <- freqresp(syst, w)
>mag = 20*log10(abs(H))
>phase <- atan2(Im(H), Re(H)) * 180/pi
>
>if the order of the system is higher than 2 it is wrong (result will be
>
>only between -pi / pi)
>
>how to proceed ? for each evaluated point take a derivative and
>evaluate
>the order to add the proper number of pi ?
>
>Thanks for the help !
>
>Best
>
>Frédéric
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: unable to plot bode - phase with control package

R help mailing list-2
thank you for the reply !

Le 08/10/2020 à 16:32, Jeff Newmiller a écrit :
> a) What is so difficult about the idea that this list is about R, not theory?

I don't need theory here, I just need the way specialist in R language
will solve this *coding* issue.

Regarding the theory I think I have some solid background.

> There do exist forums about control theory (e.g. engineering.stackexchange.com)
irrelevant if not implemented in R
> b) Using [-pi,+pi) is not "wrong"... it is numerically more precise,

I never assume it was "wrong"

asymptotic analysis will provide valuable knowledge for stability if you
reach phase information

why do you assume it is more precise ??

>   though it may not convey what you would prefer to convey.
>
> c) The general case with poles and zeroes is more complicated than just adding the order of your system. Do a search on
>
> "winding number" "bode"
in my case for 'siso' it is enough, physical systems I study are not
exhibiting very complex behavior
> But if by inspection you think that shortcut will work for your system then do what you need to.
>
> d) If implementing a more general alternative solution is your itch, I am sure the maintainer of this _contributed package_ would welcome patches to add features.

not relevant as my level is R coding is low... sorry

Still looking for a *coding* solution to my issue...

Best,

Frédéric



>
>
> On October 8, 2020 12:08:19 AM PDT, fr1d_mail via R-help <[hidden email]> wrote:
>> Dear All
>>
>> I hope my question is relevant on this forum, else very sorry for the
>> disturbance
>>
>> I want to simply plot a bode diagram of a siso model
>>
>> using the 'bodeplot' command in the control package fail due to error
>> in
>> 'issiso' evaluation...
>>
>> Error in if (issiso(sys)) {:
>>
>> then I try by myself some retro-engineering :)
>>
>> the problem is when I use
>>
>> H <- freqresp(syst, w)
>> mag = 20*log10(abs(H))
>> phase <- atan2(Im(H), Re(H)) * 180/pi
>>
>> if the order of the system is higher than 2 it is wrong (result will be
>>
>> only between -pi / pi)
>>
>> how to proceed ? for each evaluated point take a derivative and
>> evaluate
>> the order to add the proper number of pi ?
>>
>> Thanks for the help !
>>
>> Best
>>
>> Frédéric
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.