I would like to display a bode plot of a buck-boost converter using Matlab, so I got the figure shown below, If we look closer to the phase plot, we see that it starts from 360°. My wish is to make the graph starts from 0° rather than 360° in order to make the reading easier to me.
-
\$\begingroup\$ What was the dynamic system model you used? Do you use the Control System Toolbox, and if so, which command (bode, bodeplot) did you use to plot the bode diagram? \$\endgroup\$– HufiJun 5, 2020 at 19:55
-
\$\begingroup\$ Sometimes I use bode(sys,options) command, and sometimes I use margin(sys). In this display, I have used margin(sys) command. But in both cases I get the phase plot starts from 360° rather than 0° \$\endgroup\$– learn designJun 5, 2020 at 20:05
1 Answer
A possible solution would be to use bodeplot and then change the PhaseMatchingValue property. As an example, I use \$H(s)=\frac{s^4+1}{s+1}\$:
sys = tf([1 0 0 0 1],[1 1]);
h = bodeplot(sys);
p = getoptions(h);
p.PhaseMatching = 'on';
p.PhaseMatchingFreq = 1;
p.PhaseMatchingValue = 0;
setoptions(h,p);
This results in the following bode diagram
Another (not very elegant) solution using the command bode
sys = tf([1 0 0 0 1],[1 1]);
wout = logspace(-2,2,201);
[mag,phase,wout] = bode(sys,wout);
wout = squeeze(wout);
mag = squeeze(mag);
phase = squeeze(phase);
%adjusting the phase
phase = phase - 360;
subplot(2,1,1);
% plot amplitude response
semilogx(wout,20*log10(mag));
hold on;
%mark a point at wout(101)
semilogx(wout(101),20*log10(mag(101)),'xr');
text(wout(101),20*log10(mag(101)),'\omega = 1')
%plot phase response
subplot(2,1,2);
semilogx(wout,phase);