Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# makeweight

First-order weighting function with specified DC gain, crossover frequency, and high-frequency gain

`makeweight` is a convenient way to specify loop shapes, target gain profiles, or weighting functions for applications such as controller synthesis and control system tuning.

## Syntax

``W = makeweight(dcgain,wc,hfgain)``
``W = makeweight(dcgain,wc,hfgain,Ts)``

## Description

example

````W = makeweight(dcgain,wc,hfgain)` creates a stable, first-order, continuous-time state-space model whose frequency response has the specified low-frequency gain, crossover frequency, and high-frequency gain. In other words, the response of `W` satisfies: $\begin{array}{c}W\left(j\cdot 0\right)=\text{dcgain}\\ |W\left(j\cdot \text{wc}\right)|=1\\ W\left(j\cdot \infty \right)=\text{hfgain}\text{.}\end{array}$The low-frequency gain and the high-frequency gain must satisfy either |`dcgain`| < 1 < |`hfgain`| or |`hfgain`| < 1 < |`dcgain`|.```

example

````W = makeweight(dcgain,wc,hfgain,Ts)` creates a stable, first-order, discrete-time state-space model with the specified sample time. The response of `W` satisfies: $\begin{array}{c}W\left({e}^{j\cdot 0\cdot \text{Ts}}\right)=\text{dcgain}\\ |W\left({e}^{j\cdot \text{wc}\cdot \text{Ts}}\right)|=1\\ W\left({e}^{j\pi }\right)=\text{hfgain}\text{.}\end{array}$As in the continuous-time case, the low-frequency gain and the high-frequency gain must satisfy either |`dcgain`| < 1 < |`hfgain`| or |`hfgain`| < 1 < |`dcgain`|. In addition, the crossover frequency must satisfy `wc*Ts` < π.```

## Examples

collapse all

Create continuous-time weighting functions by specifying low-frequency gain, high-frequency gain, and crossover frequencies.

Create a weighting function with gain of 40 dB at low frequency, rolling off to -20 dB at high frequency. Specify a crossover frequency of 0.4 rad/s.

`Wl = makeweight(100,.4,.10);`

Create a weighting function with gain of -10 dB at low frequency, rising to 40 dB at high frequency. Specify a crossover frequency of 20 rad/s.

`Wh = makeweight(0.316,20,100);`

Plot the magnitudes of the weighting functions to confirm that they meet the response specifications.

`bodemag(Wl,Wh)`

Create a gain profile that rolls off at high frequency without flattening. Specify a gain of 40 dB at low frequency and a crossover frequency of 10 rad/s.

`W = makeweight(100,10,0);`

Specifying a high-frequency gain of 0 ensures that the frequency response rolls off at high frequencies without leveling off.

Plot the gain profile to confirm the shape.

`bodemag(W)`

Create discrete-time weighting functions by specifying low-frequency gain, high-frequency gain, crossover frequencies, and sample time.

Create a weighting function with gain of 40 dB at low frequency, rolling off to -20 dB at high frequency. Specify a crossover frequency of 0.4 rad/s and a sample time of 0.1 s.

`Wl = makeweight(100,.4,.10,0.1);`

Create a weighting function with gain of -10 dB at low frequency, rising to 40 dB at high frequency. Specify a crossover frequency of 2 rad/s and a sample time of 0.1 s.

`Wh = makeweight(0.316,2,100,0.1);`

Plot the magnitudes of the weighting functions to confirm that they meet the response specifications.

`bodemag(Wl,Wh)`

The high-frequency leveling of `Wh` is somewhat distorted due to the proximity of its crossover frequency to the Nyquist frequency.

## Input Arguments

collapse all

Low-frequency gain of the weighting function, specified as a real scalar value. The gain is expressed in absolute units. For example, to specify a low-frequency gain of 20 dB, set `dcgain` = 10.

The low-frequency gain and the high-frequency gain must satisfy either |`dcgain`| < 1 < |`hfgain`| or |`hfgain`| < 1 < |`dcgain`|.

Crossover frequency of the weighting function in radians/second, specified as a positive scalar value.

For discrete-time weighting functions, the crossover frequency must satisfy `wc*Ts`<π.

High-frequency gain of the weighting function, specified as a real scalar value. The gain is expressed in absolute units. For example, to specify a high-frequency gain of –20 dB, set `dcgain` = 0.1.

The low-frequency gain and the high-frequency gain must satisfy either |`dcgain`| < 1 < |`hfgain`| or |`hfgain`| < 1 < |`dcgain`|.

sample time of discrete-time weighting function, specified as a positive scalar value or as –1. A positive value sets the sample time in seconds. A specified sample time must satisfy `wc*Ts`<π. The value –1 creates a discrete-time state-space model with unspecified sample time.

## Output Arguments

collapse all

Weighting function, returned as a state-space (`ss`) model. For continuous-time weighting functions, the response of `W` satisfies:

`$\begin{array}{c}W\left(j\cdot 0\right)=\text{dcgain}\\ |W\left(j\cdot \text{wc}\right)|=1\\ W\left(j\cdot \infty \right)=\text{hfgain}\text{.}\end{array}$`

For discrete-time weighting functions, the response of `W` satisfies:

`$\begin{array}{c}W\left({e}^{j\cdot 0\cdot \text{Ts}}\right)=\text{dcgain}\\ |W\left({e}^{j\cdot \text{wc}\cdot \text{Ts}}\right)|=1\\ W\left({e}^{j\pi }\right)=\text{hfgain}\text{.}\end{array}$`