This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Mouse-based tool for sketching and fitting


[sysout,pts] = drawmag(data)
[sysout,pts] = drawmag(data,init_pts)


drawmag interactively uses the mouse in the plot window to create pts (the frd object) and sysout (a stable minimum-phase ss object), which approximately fits the frequency response (magnitude) in pts.

Input arguments:


Either a frequency response object that is plotted as a reference, or a constant matrix of the form [xmin xmax ymin ymax] specifying the plot window on the data.


Optional frd objects of initial set of points

Output arguments:


Stable, minimum-phase ss object that approximately fits, in magnitude, the pts data.


Frequency response of points.

While drawmag is running, all interaction with the program is through the mouse and/or the keyboard. The mouse, if there is one, must be in the plot window. The program recognizes several commands:

  • Clicking the mouse button adds a point at the cross-hairs. If the cross-hairs are outside the plotting window, the points are plotted when the fitting, windowing, or replotting mode is invoked. Typing a is the same as clicking the mouse button.

  • Typing r removes the point with frequency nearest that of the cross-hairs.

  • Typing any integer between 0 and 9 fits the existing points with a transfer function of that order. The fitting routine approximately minimizes the maximum error in a log sense. The new fit is displayed along with the points, and the most recent previous fit, if it exists.

  • Typing w uses the cross-hair location as the initial point in creating a window. Moving the cross-hairs and clicking the mouse or pressing any key then gives a second point at the new cross-hair location. These two points define a new window on the data, which is immediately replotted. This is useful in fine tuning parts of the data. You can call windowing repeatedly.

  • Typing p simply replots the data using a window that covers all the current data points as well as whatever was specified in in. Typically used after windowing to view all the data.

  • Typing k invokes the keyboard using the keyboard command. Be cautious when using this option to avoid unintended changes to variables.

See Also


Introduced before R2006a

Was this topic helpful?