If no output arguments are given: produce Bode plots of a system; otherwise, compute the frequency response of a system data structure
Inputs
Outputs
- sys
- a system data structure (must be either purely continuous or discrete; see is_digital)
- w
- frequency values for evaluation.
if sys is continuous, then bode evaluates G(jw) where G(s) is the system transfer function.
if sys is discrete, then bode evaluates G(
exp(jwT)), where
- T is the system sampling time
- G(z) is the system transfer function.
Default the default frequency range is selected as follows: (These steps are not performed if w is specified)
- via routine __bodquist__, isolate all poles and zeros away from w=0 (jw=0 or
exp(jwT)=1) and select the frequency range based on the breakpoint locations of the frequencies.- if sys is discrete time, the frequency range is limited to jwT in [0,2 pi /T]
- A "smoothing" routine is used to ensure that the plot phase does not change excessively from point to point and that singular points (e.g., crossovers from +/- 180) are accurately shown.
- out_idx
- in_idx
- The names or indices of outputs and inputs to be used in the frequency response. See
sysprune.Example
bode(sys,[],"y_3", {"u_1","u_4"});
- mag
- phase
- the magnitude and phase of the frequency response G(jw) or G(
exp(jwT)) at the selected frequency values.- w
- the vector of frequency values used
- If no output arguments are given, e.g.,
bode(sys);bode plots the results to the screen. Descriptive labels are automatically placed.
Failure to include a concluding semicolon will yield some garbage being printed to the screen (
ans = []).- If the requested plot is for an MIMO system, mag is set to ||G(jw)|| or ||G(
exp(jwT))|| and phase information is not computed.