MATLAB: Bode() magnitude

bodefreqmagphase

Hi, I Have seen the code [ mag,phase] = bode(sy s) but when i try to see the values of mag, or phase, it returns something like mag(:,:,1). What is the significance of the stuff in the brackets? How can i just get the magnitude values with respect to frequency so I can plot a 2d plot of the magnitude and frequency?
thanks

Best Answer

Magnitude and phase outputs of bode are 3-D arrays, for representing multi-input multi-output systems. The first two dimensions correspond to the number of inputs and outputs, the third dimension corresponds to the number of frequency points. In your case you have a single-input single-output system, so size(mag) is 1 1 n, where n is the number of frequency points.
To get a standard bode plot you can just do
bode(sys)
If you want access to mag and phase as regular vectors, just do
mag=squeeze(mag)
All of this is covered in the doc.
Arkadiy