Remove Frequency Label bodelplot

23 visualizaciones (últimos 30 días)
J B
J B el 30 de Abr. de 2019
Comentada: Blake Cole el 25 de En. de 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 comentario
Benjamin Gelzinnes
Benjamin Gelzinnes el 5 de Jul. de 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?

Iniciar sesión para comentar.

Respuestas (1)

Voss
Voss el 7 de Jul. de 2023
Editada: Voss el 7 de Jul. de 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';

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by