I want to change the units of frequency and magnitude in the Bode Diagram, How can I do this?
Prashant Kumar answered .
2025-11-20
h = gcr setoptions(h,'FreqUnits','Hz')
% plot a bode diagram H = tf([1 0.1 7.5],[1 0.12 9 0 0]); Hd = c2d(H,0.5,'zoh'); bode(H,'r',Hd,'b--') % Get the figure handle h = gcf; % Change the units of Phase from degrees to radians u = h.Children(2).Children(2).Children.YData; h.Children(2).Children(2).Children.YData = u*(pi/180); % Change the units of Phase degrees to radians t = h.Children(2).Children(1).Children.YData; h.Children(2).Children(1).Children.YData = t*(pi/180); % Set the Y axis limits in visible range h.Children(2).YLim = [-5 0]; % Change the labels of Phase plot to reflect the change of units h.Children(2).YLabel.String = 'Phase (rad)';