www.gusucode.com > control 案例程序 matlab源码代码 > control/CreateParametricDiagonalMatrixExample.m

    %% Create Parametric Diagonal Matrix
% 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;