Find Bode Phase of Uncertainty models

9 views (last 30 days)
John
John on 28 Jan 2022
Commented: John on 31 Jan 2022
How can I find the phase programatically, of an Uncertainty plot like this one? This transfer function is build using the Robust Controls toolbox.
Eg I'd like to read at what frequency range, the phase drops to (say) -45 degrees.
If this was a normal bode of a single SISO model, it'd be easy: do a bodeplot() and read out phase and magnitude data, and/or use margin().
But this is an uncertain model range. I don't know how to read out the phase data, much less its bounds.
Does anyone know how to get phase data of Uncertain models?
% Transfer function (with uncertainty) example
a = ureal('a', 1, 'percent', 50);
s = tf('s');
res = 1 / (s + a);
bode(res);
  1 Comment
Star Strider
Star Strider on 28 Jan 2022
Please see my Comment to yout previous Question. It applies here, too.

Sign in to comment.

Accepted Answer

Paul
Paul on 28 Jan 2022
I don't know if there is much control over what bode() does with a uss input, but you can get at the data in the plot after the fact. Kind of kludgy though. Disappointing that bode() with return arguments doesn't return the mag and phase of all of the curves.
% Transfer function (with uncertainty) example
a = ureal('a', 1, 'percent', 50);
s = tf('s');
res = 1 / (s + a);
bode(res);
hax = get(gcf,'Children');
hg = get(hax(2),'Children')
hg =
2×1 graphics array: Group (res) Line
get(hg(1))
Annotation: [1×1 matlab.graphics.eventdata.Annotation] BeingDeleted: off BusyAction: 'queue' ButtonDownFcn: '' Children: [21×1 Line] ContextMenu: [0×0 GraphicsPlaceholder] CreateFcn: '' DeleteFcn: '' DisplayName: 'res' HandleVisibility: 'on' HitTest: on Interruptible: on Parent: [1×1 Axes] PickableParts: 'visible' ScribeContextMenu: [] Selected: off SelectionHighlight: on Tag: '' Type: 'hggroup' UserData: [] Visible: on
So hg(1).Children is an hggroup that contains 21 Lines, for which the XData and YData are accessible. For example, replot one of the phase curves.
semilogx(hg(1).Children(1).XData,hg(1).Children(1).YData);
xlim([.02 100])
If the line data is accessible, it can be processed after pulling it all out of the plots.
  1 Comment
John
John on 31 Jan 2022
Thank you -- I will try this out as a starting point.
(If it looks like it leads to where I'm trying to go, I'll mark it as an accepted answer)

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with Control System Toolbox in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!