generate samples of uncertain systems -凯发k8网页登录

main content

generate samples of uncertain systems

use the function to randomly sample an uncertain model, returning one or more non-uncertain instances of the uncertain model.

generating one sample

if a is an uncertain object, then usample(a) generates a single sample of a.

for example, a sample of a ureal is a scalar double.

a = ureal('a',6); 
b = usample(a) 
b = 
    5.7298 

create a 1-by-3 with a and an uncertain complex parameter c. a single sample of this is a 1-by-3 double.

c = ucomplex('c',2 6j); 
m = [a c a*a]; 
usample(m) 
ans = 
   5.9785             1.4375   6.0290i  35.7428          

generating many samples

if a is an uncertain object, then usample(a,n) generates n samples of a.

for example, 20 samples of a gives a 1-by-1-20 double array.

b = usample(a,20); 
size(b) 
ans = 
     1     1    20 

similarly, 30 samples of the 1-by-3 m yields a 1-by-3-by-30 array.

size(usample(m,30)) 
ans = 
     1     3    30 

see for more information on sampling uncertain objects.

sampling uncertain lti dynamics

when sampling an ultidyn element or an uncertain object that contains a ultidyn element, the result is always a state-space (ss) object. the property samplestatedimension of the ultidyn class determines the state dimension of the samples. the same is true when sampling umargin objects, since these are a type of dynamic uncertainty.

create a 1-by-1, gain bounded ultidyn object with gain bound 4. verify that the default state dimension for samples is 3.

del = ultidyn('del',[1 1],'bound',4); 
del.samplestatedimension
ans = 3

sample the uncertain element at 30 points. verify that this creates a 30-by-1 ss array of 1-input, 1-output, 1-state systems.

rng(0)  % for reproducibility
dels = usample(del,30); 
size(dels)
30x1 array of state-space models.
each model has 1 outputs, 1 inputs, and 3 states.

plot the nyquist plot of these samples and add a disk of radius 4, the gain bound of del.

nyquist(dels) 
hold on; 
theta = linspace(-pi,pi); 
plot(del.bound*exp(sqrt(-1)*theta),'r'); 
hold off;

figure contains an axes object. the axes object contains 31 objects of type line. this object represents del.

change samplestatedimension to 1, and repeat entire procedure. the nyquist plots again satisfy the gain bound, but the nyquist plots are all circles, indicative of 1st order systems.

del.samplestatedimension = 1; 
dels = usample(del,30);   
nyquist(dels) 
hold on; 
theta = linspace(-pi,pi); 
plot(del.bound*exp(sqrt(-1)*theta),'r'); 
hold off;

figure contains an axes object. the axes object contains 31 objects of type line. this object represents del.

with samplestatedimension = 1, all nyquist plots touch the gain boundary at either (–1,0) or (1,0) (frequency = 0 or inf). higher sampling dimension yields a nyquist curve that reaches the gain bound at more frequencies, yielding more thorough coverage.

create a object using the default samplestatedimension. the umargin block models uncertain gain and phase. the modeled variations are within bounded ranges. for this example use a umargin block that captures relative gain variations of a factor of two in either direction, and phase variations of ±30°.

dgm = getdgm(2,30,'tight');
f = umargin('f')
uncertain gain/phase "f" with relative gain change in [0.5,2] and phase change of ±36.9 degrees.

the samples of a umargin block are also state-space models.

fs = usample(f,30);
size(fs)
30x1 array of state-space models.
each model has 1 outputs, 1 inputs, and 3 states.

plot the samples on the nyquist plane.

nyquist(fs)

figure contains an axes object. the axes object contains 30 objects of type line. this object represents f.

the nyquist plot of any sample of f stays within the disk of uncertainty modeled by f. to confirm this bound, use plot to examine the uncertainty disk. compare the nyquist plot above with the right side of the following plot.

plot(f)

figure contains 2 axes objects. axes object 1 with title range of gain and phase variations, xlabel gain variation (db), ylabel phase variation (degrees) contains 5 objects of type patch, text, line. axes object 2 with title values of multiplicative factor f contains 8 objects of type patch, line, text.

for further details about the gain and phase uncertainty model, see .

see also

|

related topics

    网站地图