Main Content

getTestValue

Access test values for validating data function

Since R2023a

Description

t0 = getTestValue(vSys) returns the test time t0 used to validate the data function.

[t0,p0] = getTestValue(vSys) returns the test time t0 and parameter values p0 used to validate the data function of LPV models.

example

Examples

collapse all

For this example, the dataFcnMaglev.m data function describes the dynamics of a magnetic levitation system.

This model is not valid for height h = 0. Create an LPV model with a different value for the test height. For this model set t0 = 0 because the parameters do not depend explicitly on time.

h0 = 1;
sys = lpvss('h',@dataFcnMaglev,0,0,h0)
Continuous-time state-space LPV model with 1 outputs, 1 inputs, 2 states, and 1 parameters.

Get the test values lpvss used to validate dataFcnMaglev.m.

[t0,p0] = getTestValue(sys)
t0 = 
0
p0 = 
1

The function returns the same value that was used to validate the data function when you created the LPV object.

View the data function code.

type dataFcnMaglev.m
function [A,B,C,D,E,dx0,x0,u0,y0,Delays] = dataFcnMaglev(~,p)
% MAGLEV example:
% x = [h ; dh/dt]
% p=hbar (equilibrium height)
mb = 0.02; % kg
g = 9.81;
alpha = 2.4832e-5;
A = [0 1;2*g/p 0];
B = [0 ; -2*sqrt(g*alpha/mb)/p];
C = [1 0];  % h
D = 0;
E = [];
dx0 = [];
x0 = [p;0];
u0 = sqrt(mb*g/alpha)*p;  % ibar
y0 = p;                   % y = h = hbar + (h-hbar)
Delays = [];

Input Arguments

collapse all

LTV or LPV model, specified as an ltvss or lpvss object, respectively.

Output Arguments

collapse all

Test value of time, returned as a scalar. This is the value ltvss and lpvss uses to evaluate the data function.

Test values of parameters, returned as a vector of length equal to the number of parameters in the model. These are the values lpvss uses to evaluate the data function.

Version History

Introduced in R2023a