dmatrix.m
来自「用于汽车巡航控制系统的模糊控制算法」· M 代码 · 共 26 行
M
26 行
function [D, d] = DMatrix(n)
% Create the D matrix and d vector for constrained Kalman filtering.
% The input n is an array containing the total number of fuzzy membership
% functions that are being optimized for each fuzzy variable.
nRows = 0;
nCols = 0;
for i = 1 : size(n, 2)
nRows = nRows + 2 * (n(i) - 1);
nCols = nCols + 3 * n(i);
end
D = zeros(nRows, nCols);
OddRow = [0 1 1 0 0 -1];
EvenRow = [0 0 1 1 0 -1];
iRow = 1;
iCol = 1;
for i = 1 : size(n, 2)
for j = 1 : n(i) - 1
D(iRow:iRow+1, iCol:iCol+5) = [OddRow; EvenRow];
iRow = iRow + 2;
iCol = iCol + 3;
end
iCol = iCol + 3;
end
d = zeros(nRows, 1);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?