Bode plot with right half plane zero
22 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, while using the bode function in matlab script for a transfer function which has right half plane zero, I am finding that the phase is starting from 360 instead of starting from 0. How can this be corrected. The code is inserted.
clc
clear all
s=tf('s')
fs=1e6;
ws=2*pi*fs;
L=1.8e-6;
C=220e-6;
R=5;
Vin=9;
Kg=1/5;
Vcarr=1;
Vbase=5;
Ibase=5;
Zb=Vbase/Ibase
%% Plant TFs
Vo=5;
D=0.357;
wrz=((1-D)^2)*R/(D*L); %% position of the RHP zero
wc=(1-D)/sqrt(L*C);
Q=(1-D)*R*sqrt(C/L);
Gdo=Vo/(D*(1-D));
Gvd=Gdo*(1-(s/wrz))/(((s/wc)^2)+(s/(Q*wc))+1); % control to output
%% bode plots
wct=1:10:10e7;
bode(Gvd,wct);
0 comentarios
Respuestas (4)
Paul
el 10 de Nov. de 2025
The bodeplot function offers options on controlling the appearance of the plot, including to force the phase between +-180 deg.
A bigger hammer would be to use ctrlpref to set the default phase wrapping preference for bode and bodeplot (actually, I'm not 100% sure it applies to bodeplot, some experimentation may be in order).
1 comentario
Mathieu NOE
el 10 de Nov. de 2025
hello @Paul
+1
see my suggestion above
you can force the phase between +-180 deg with the regular bode function
Andrew Ouellette
el 10 de Nov. de 2025
You are looking for the phase matching options in bodeplot, which you can interpret as "If PhaseMatchingEnabled, then keep phase close to PhaseMatchingValue at the PhaseMatchingFrequency". Here is an example using your code:
s=tf('s');
fs=1e6;
ws=2*pi*fs;
L=1.8e-6;
C=220e-6;
R=5;
Vin=9;
Kg=1/5;
Vcarr=1;
Vbase=5;
Ibase=5;
Zb=Vbase/Ibase;
%% Plant TFs
Vo=5;
D=0.357;
wrz=((1-D)^2)*R/(D*L); %% position of the RHP zero
wc=(1-D)/sqrt(L*C);
Q=(1-D)*R*sqrt(C/L);
Gdo=Vo/(D*(1-D));
Gvd=Gdo*(1-(s/wrz))/(((s/wc)^2)+(s/(Q*wc))+1); % control to output
%% bode plots
wct={1 10e7};
h = bodeplot(Gvd,wct);
h.PhaseMatchingEnabled = true;
h.PhaseMatchingValue = 0;
h.PhaseMatchingFrequency = 0;
0 comentarios
Claire
el 10 de Nov. de 2025
When you use the bode function to plot the Bode diagram of a transfer function that has a right-half plane (RHP) zero, you may notice that the phase starts from 360 degrees instead of 0 degrees. This is because MATLAB does not normalize the phase when calculating it; therefore, when the phase exceeds 180 degrees, it will be displayed as a value greater than 180 degrees.
Mathieu NOE
el 10 de Nov. de 2025
hello
you can do this way :
BTW , you pulstaion vector was huge and there is a better approach for Bode plots (as the x axis is log scaled ,use therefore a log spaced frequency / pulstaion vector)
here 500 values are enough to make a correct plot
clc
clear all
s=tf('s')
fs=1e6;
ws=2*pi*fs;
L=1.8e-6;
C=220e-6;
R=5;
Vin=9;
Kg=1/5;
Vcarr=1;
Vbase=5;
Ibase=5;
Zb=Vbase/Ibase
%% Plant TFs
Vo=5;
D=0.357;
wrz=((1-D)^2)*R/(D*L); %% position of the RHP zero
wc=(1-D)/sqrt(L*C);
Q=(1-D)*R*sqrt(C/L);
Gdo=Vo/(D*(1-D));
Gvd=Gdo*(1-(s/wrz))/(((s/wc)^2)+(s/(Q*wc))+1); % control to output
%% bode plot
freq=logspace(1,7,500);
[g,p] = bode(Gvd,2*pi*freq);
g = g(:);
p = p(:) - 360 ;
figure
subplot(2,1,1),semilogx(freq,20*log10(g))
ylabel('Modulus (dB)')
title('Bode Plot')
grid on
subplot(2,1,2),semilogx(freq,p)
xlabel('Frequency')
ylabel('Phase(°)')
grid on
Ver también
Categorías
Más información sobre Plot Customization en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



