Documentation

realp

Real tunable parameter

Syntax

p = realp(paramname,initvalue)

Description

p = realp(paramname,initvalue) creates a tunable real-valued parameter with name specified by the string paramname and initial value initvalue. Tunable real parameters can be scalar- or matrix- valued.

Input Arguments

paramname

String specifying the name of the realp parameter p. This input argument sets the value of the Name property of p.

initvalue

Initial numeric value of the parameter p. initvalue can be a real scalar value or a 2-dimensional matrix.

Output Arguments

p

realp parameter object.

Properties

Name

String containing the name of the realp parameter object. The value of Name is set by the paramname input argument to realp and cannot be changed.

Value

Value of the tunable parameter.

Value can be a real scalar value or a 2-dimensional matrix. The initial value is set by the initvalue input argument. The dimensions of Value are fixed on creation of the realp object.

Minimum

Lower bound for the parameter value. The dimension of the Minimum property matches the dimension of the Value property.

For matrix-valued parameters, use indexing to specify lower bounds on individual elements:

 p = realp('K',eye(2));
 p.Minimum([1 4]) = -5;

Use scalar expansion to set the same lower bound for all matrix elements:

p.Minimum = -5;

Default: -Inf for all entries

Maximum

Upper bound for the parameter value. The dimension of the Maximum property matches the dimension of the Value property.

For matrix-valued parameters, use indexing to specify upper bounds on individual elements:

 p = realp('K',eye(2));
 p.Maximum([1 4]) = 5;

Use scalar expansion to set the same upper bound for all matrix elements:

p.Maximum = 5;

Default: Inf for all entries

Free

Boolean value specifying whether the parameter is free to be tuned. Set the Free property to 1 (true) for tunable parameters, and 0 (false) for fixed parameters.

The dimension of the Free property matches the dimension of the Value property.

Default: 1 (true) for all entries

Examples

Tunable Low-Pass Filter

This example shows how to create the low-pass filter F = a/(s + a) with one tunable parameter a.

You cannot use ltiblock.tf to represent F, because the numerator and denominator coefficients of an ltiblock.tf block are independent. Instead, construct F using the tunable real parameter object realp.

  1. Create a tunable real parameter.

    a = realp('a',10);   
    

    The realp object a is a tunable parameter with initial value 10.

  2. Use tf to create the tunable filter F:

    F = tf(a,[1 a]);

F is a genss object which has the tunable parameter a in its Blocks property. You can connect F with other tunable or numeric models to create more complex models of control systems. For an example, see Control System with Tunable Components.

Parametric Diagonal Matrix

This example shows how to create a parametric matrix whose off-diagonal terms are fixed to zero, and whose diagonal terms are tunable parameters.

  1. Create a parametric matrix whose initial value is the identity matrix.

    p = realp('P',eye(2));
    

    p is a 2-by-2 parametric matrix. Because the initial value is the identity matrix, the off-diagonal initial values are zero.

  2. Fix the values of the off-diagonal elements by setting the Free property to false.

    p.Free(1,2) = false;
    p.Free(2,1) = false;

More About

expand all

Tips

  • Use arithmetic operators (+, -, *, /, \, and ^) to combine realp objects into rational expressions or matrix expressions. You can use the resulting expressions in model-creation functions such as tf, zpk, and ss to create tunable models. For more information about tunable models, see Models with Tunable Coefficients in the Control System Toolbox™ User's Guide.

See Also

| | |

Was this topic helpful?