Demo entry 6624016

123

   

Submitted by anonymous on Jun 13, 2017 at 07:37
Language: Matlab. Code size: 671 Bytes.

clear;clc;

A(:,:,1) = eye(2); %生成2阶单一矩阵(对角线元素为1,其余为0)
A(:,:,2) = [-1.5 0.4; -0.2 0];
A(:,:,3) = [0.7 0 ; 0.01 -0.7];
B(:,:,1) = [0 0.4 0;1 0 0];
B(:,:,2) = [0 -0.1 0;0 0 3];
B(:,:,3) = [0 0.15 0;0 0 4];
B(:,:,4) = [0 0 0;0 0 0];
B(:,:,5) = [0.2 0 0;0 2 0];
B(:,:,6) = [0.3 0 0;0 0 0];

m0 = idarx(A,B); %创建IDARX模型对象

u = iddata([], idinput([200,3])); %生成200*3维二值伪随机信号(M序列),作为输入信号
e = iddata([], randn(200,2)); %生成200*2维随机数,作为误差信号
y = sim(m0, [u e]); %生成200*2维白噪声信号

na = [2 1;2 2]; %参数来源于结构体m0
nb = [2 3 0;1 1 2];
nk = [4 0 0;0 4 1];

me = arx([y u],[na nb nk]) %自回归模型

me.a %评估多项式 A
present(me); %显示模型的信息
figure,compare([y u],me); %预测输出与实际输出比较

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).