Contenuto principale

realp

Real tunable parameter

Description

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

You can use arithmetic operators (+, -, *, /, \, and ^) to combine realp objects into a rational or matrix expression represented as a genmat object.

You can create tunable genss models by using realp and genmat objects as inputs to tf and ss. For more information about tunable models, see Models with Tunable Coefficients.

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 or string. This input argument sets the value of the Name property of p.

Initial numeric value of the parameter, specified as a real scalar, vector, or 2-dimensional matrix. This input argument sets the initial value of the Value property of p.

Output Arguments

expand all

Real tunable parameter, returned as a realp object.

Properties

expand all

Parameter name, specified as a string or character vector and stored as a character vector. The value of Name is set by the paramname input argument.

Value of the tunable parameter, specified as a real scalar, vector, or 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.

Lower bound for the parameter value, specified as a real scalar, vector, or 2-dimensional matrix. The dimensions of Minimum match the dimensions of Value.

For matrix-valued parameters, use indexing to specify lower bounds for 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;

Upper bound for the parameter value, specified as a real scalar, vector, or 2-dimensional matrix. The dimensions of Maximum match the dimensions of Value.

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;

Boolean value specifying whether the parameter is free to be tuned, specified as a logical scalar, vector, or 2-dimensional matrix, where 1 (true) indicates a tunable parameter and 0 (false) indicates a fixed parameter.

The dimensions of the Free property match the dimensions of Value.

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.
Model Properties

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;

Version History

Introduced in R2011a