From ControlTheoryPro.com

Contents
1 Introduction
This article is on the topic of creating Bode plots in MATLAB. The quick answer is use the bode command. However, the bode command has several options and the plots generated by the bode command are not easily reformatted. The default formatting of most MATLAB plots is good for analysis but less than ideal for dropping into Word and PowerPoint documents or even this website. As a result this article presents an alternative that requires more lines of code but offers the full formatting flexibility of the generic plot command.
2 MATLAB's Bode Command
The basic bode command is as follows
>> bode(LTI_SYS)
where
The bode command will automatically call gcf which will put the bode plot on the current figure. If no figure exists then one is created by gcf.
If you wish to specify the frequency points at which LTI_SYS is plotted then create a frequency vector using logspace or linspace as follows
>> freqVec = logspace(1, 3, 5000); >> bode(LTI_SYS, freqVec * (2*pi))
where
 freqVec is a vector of 5000 frequencies, in Hz, spaced evenly on a log scale from 10^{1} to 10^{3}
 pi is a MATLAB constant equal to the value of and in this case it is used to convert freqVec to rad/sec as it is passed to the bode command
In order to get the magnitude and phase at each frequency point the bode command must be called with output arguments such as
>> [mag, phase] = bode(LTI_SYS);
or
>> [mag, phase] = bode(LTI_SYS, freqVec * (2*pi));
where
 mag is the magnitude (not in dB) at each point in freqVec
 phase is the phase (in degrees) at each point in freqVec
The mag and phase variables must come out as 3D arrays. Assuming LTI_SYS is SISO then the commands below will convert mag and phase into the vectors you would expect
>> mag = mag(:); >> phase = phase(:); >> mag = db(mag); % to get the magnitude in 20log dB
2.1 Issues with the bode command
The main issue with the bode command is reformatting of the plot. The bode command appears to use a normal semilogx plot and then apply patches ro something similar to the figure. This can lead to odd behavior when attempting to create multiline titles, reformat line widths or font sizes, etc. The normal relationship of axes to figure is just not quite present.
3 Manually create a bode plot
Since the bode command will return a magnitude and phase a bode plot can be created manually. It is done in this fashion
>> freqVec = logspace(1, 3, 5000);
>> [mag, phase] = bode(LTI_SYS, freqVec * (2*pi));
>> figure; >> subplot(2, 1, 1) >> semilogx(freqVec, db(mag(:))) >> subplot(2, 1, 2) >> semilogx(freqVec, phase(:))
3.1 Example Honeywell GG530 MEMS Rate Gyro
Honeywell GG5300 MEMS Rate Gyro Plant
The Honeywell GG5300 Three Axis MEMS Rate Gyro is advertised as being for "Missiles & Munitions." The datasheet available on Honeywell's website states
Bandwidth @ 90 deg phase  100 Hz typical 
The typical sensor model would have the following parameters
Hz,  , 
The sensor has a scale factor (Volts per radian) that we are ignoring for now. (The scale factor here is just a gain. External electronics can make this scale factor whatever is convenient.) Using the parameters in the above table a transfer function can be formed in MATLAB with the following commands
>> wn = 100 * (2*pi); >> z = 1/sqrt(2); >> K = 1; >> GG5300 = tf(K * [wn^2], [1, 2*z*wn, wn^2]);
The resulting frequency response for a single axis is
MATLAB Note 
It is fine to model this sensor as a transfer function. However, when combined into a larger LTI model it is recommended that every individual piece of the larger model be converted to a statespace object. Statespace objects are more accurate. 
For most models each axis can be modelled with an identical transfer function.