Question
I'm trying to look at the phase and gain margin of an openloop system. Due to presentation/publications, I had to designa function to plot my amplitude and phase response with good font, font dimensions etc. To do so, I'm using the bode function to extract the data from my state space systems. But I have a problem with a phase offset (value at 0Hz). I know we can remove it from the properties editor avalaible in the classical bode plot but is there a solution to correct it when using this syntax [mag,phase,wout] = bode(sys,w) ?
Expert Answer
Neeta Dsouza
PhD Expert
Answered Aug 25, 2026
if you want - as you write - stick to the bode output you should correct the phase by a reference phase shift.
% create tf sys = tf(1,[1 0]); % calculate frequency response using bode w = 2*pi*logspace(log10(0.1),log10(1e5),1000); [mag,phase,wout] = bode(sys,w); mag = squeeze(mag); phase = squeeze(phase); % correct phase w_ref = 2*pi*1; % reference is 1 Hz here, 0 works as well for DC [~,corrPhase,~] = bode(sys,w_ref); phase = phase-corrPhase;
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related bode Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →