Main Content

realp

Real tunable parameter

Description

realp is tunable real parameter that can be scalar-valued or matrix-valued.

Creation

Description

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

example

Input Arguments

expand all

Name of the realp parameter p, specified as a character vector such as 'a' or 'zeta'. This input argument sets the value of the Name property of p.

Data Types: char

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

Data Types: scalar

Output Arguments

expand all

realp parameter object.

Data Types: char

Properties

expand all

Name of the realp parameter object, stored as a character vector. The value of Name is set by the paramname input argument to realp and cannot be changed.

Data Types: char

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.

Data Types: scalar

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;

Data Types: scalar

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;

Data Types: scalar

Boolean value specified as 1 (true) for tunable parameters, and 0 (false) for fixed parameters.

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

Data Types: logical

Examples

collapse all

In this example, you will create a low-pass filter with one tunable parameter a:

F=as+a

Since the numerator and denominator coefficients of a tunableTF block are independent, you cannot use tunableTF to represent F. Instead, construct F using the tunable real parameter object realp.

Create a real tunable parameter with an initial value of 10.

a = realp('a',10)
a = 
       Name: 'a'
      Value: 10
    Minimum: -Inf
    Maximum: Inf
       Free: 1

Real scalar parameter.

Use tf to create the tunable low-pass filter F.

numerator = a;
denominator = [1,a];
F = tf(numerator,denominator)
Generalized continuous-time state-space model with 1 outputs, 1 inputs, 1 states, and the following blocks:
  a: Scalar parameter, 2 occurrences.

Type "ss(F)" to see the current value and "F.Blocks" to interact with the blocks.

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 control system models. For an example, see Control System with Tunable Components.

Create a matrix with tunable diagonal elements and with off-diagonal elements fixed to zero.

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

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

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

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;

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.

Version History

Introduced in R2011a