Remove Frequency Label bodelplot

23 views (last 30 days)
J B
J B on 30 Apr 2019
Commented: Blake Cole on 25 Jan 2024
I have a figure in which i plot multiple bode plots in a for loop, e.g. this way:
figure(1)
hold on;
for j=1:len
% Calculate stuff
figure(1)
bodeplot(G(j));
% Do other stuff
% Plot other stuff into other figure
end
The result you see in the attached picture, it is working fine. Afterwards I want to do some axis manipulation, change the figure size, add some labels and save it into a pdf and png. The problem I face is, that I don't get rid of the "Frequency (Hz)" label which gets automatically printed below X-axis of the phase plot. How can I remove this? I tried to acess the axes of the bodeplot via figure(1).Children. I find the axes for phase and magnitude there, but the labels are not corresponding to them. Using bodeoptions is also not working:
opts.XLabel.String = '';
bodeplot(G(j),opts);
because this removes the "Frequency", but not the "(Hz)" so instead of "Frequency (Hz)" it now says only "(Hz)".
  1 Comment
Benjamin Gelzinnes
Benjamin Gelzinnes on 5 Jul 2023
I have the same Problem..
I need to have a Bodeplot with a different x-Label.
With the bodeplot function you can change y-Labels by using:
graphics_handle=gcf;
graphics_handle.Children(2).YLabel.String = 'Phase in Deg';
graphics_handle.Children(3).YLabel.String = 'Amplitude in dB';
But when I add graphics_handle.Children(2).XLabel.String = 'Frequenz in Hz';
It just adds a line to the x-Axis. Like why?
Is there any way to remove the default x-Label?

Sign in to comment.

Answers (1)

Voss
Voss on 7 Jul 2023
Edited: Voss on 7 Jul 2023
@J B, @Benjamin Gelzinnes: Apparently, the XLabel of a Bode diagram created with bodeplot belongs to an axes whose HandleVisibility is 'off', which means you won't see it in the list of the figure's Children but you can find it using findall.
Make three bode plots:
G = [tf([1 2 1],[1 1 2]) tf([1 2 2],[2 1 2]) tf([2 2 1],[1 2 2])];
len = numel(G);
f = figure();
hold on;
for j=1:len
bodeplot(G(j));
% Do other stuff
% Plot other stuff into other figure
end
The figure's Children are two axes and a context menu:
f.Children
ans =
3×1 graphics array: ContextMenu Axes Axes
But actually, there's another axes in the figure (which is the one you want to modify):
ax = findall(f,'Type','axes')
ax =
3×1 Axes array: Axes (Bode Diagram) Axes Axes
But its 'HandleVisibility' is set to 'off':
get(ax,'HandleVisibility')
ans = 3×1 cell array
{'off'} {'on' } {'on' }
Anyway, now that you have the handle to the correct axes, you can modify it at will:
ax(1).XLabel.String = 'whatever you want';

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!