增广最小二乘辨识白噪声和有色噪声的区别是什么剖析.docx
- 文档编号:5969747
- 上传时间:2023-01-02
- 格式:DOCX
- 页数:19
- 大小:267.51KB
增广最小二乘辨识白噪声和有色噪声的区别是什么剖析.docx
《增广最小二乘辨识白噪声和有色噪声的区别是什么剖析.docx》由会员分享,可在线阅读,更多相关《增广最小二乘辨识白噪声和有色噪声的区别是什么剖析.docx(19页珍藏版)》请在冰豆网上搜索。
增广最小二乘辨识白噪声和有色噪声的区别是什么剖析
第一次作业
1、增广最小二乘辨识
模型结构如下所示:
其中,a1=-1.8,a2=0.9,b1=0.8,b2=0.3,d1=1,d2=0.4。
对其进行MATLAB仿真。
解:
增广最小二乘辨识程序:
>>clear
L=60;
y1=1;y2=1;y3=1;y4=0;
fori=1:
L;
x1=xor(y3,y4);
x2=y1;
x3=y2;
x4=y3;
y(i)=y4;
ify(i)>0.5,u(i)=-1;
elseu(i)=1;
end
y1=x1;y2=x2;y3=x3;y4=x4;
end
figure
(1);
subplot(2,1,1);
stem(u),gridon
v=randn(1,60);
subplot(2,1,2);
plot(v),gridon;
u,v%显示输入信号和噪声信号
z=zeros(7,60);zs=zeros(7,60);zm=zeros(7,60);zmd=zeros(7,60);
z
(2)=0;z
(1)=0;zs
(2)=0;zs
(1)=0;zm
(2)=0;zm
(1)=0;zmd
(2)=0;zmd
(1)=0;
c0=[0.10.10.10.10.10.10.1]';
p0=10^6*eye(7,7);
E=0.00000000005;
c=[c0,zeros(7,14)];
e=zeros(7,15);
fork=3:
60;
z(k)=1.8*z(k-1)-0.9*z(k-2)+0.8*u(k-1)+0.3*u(k-2)+v(k)+v(k-1)+0.4*v(k-2);
h1=[-z(k-1),-z(k-2),u(k-1),u(k-2),v(k),v(k-1),v(k-2)]';
x=h1'*p0*h1+1;x1=inv(x);k1=p0*h1*x1;
d1=z(k)-h1'*c0;c1=c0+k1*d1;
zs(k)=-1.8*z(k-1)+0.9*z(k-2)+0.8*u(k-1)+0.3*u(k-2);%系统在M序列的输入下的输出响应
zm(k)=[-z(k-1),-z(k-2),u(k-1),u(k-2)]*[c1
(1);c1
(2);c1(3);c1(4)];
zmd(k)=h1'*c1;
e1=c1-c0;e2=e1./c0;
e(:
k)=e2;
c0=c1;
c(:
k)=c1;
p1=p0-k1*k1'*[h1'*p0*h1+1];%findp(k)
p0=p1;
ife2<=Ebreak;
end
end
c,e,%显示被辨识参数及参数收敛情况
z,zs,zm%显示输出采样值、系统实际输出值、模型输出值
%分离变量
a1=c(1,:
);a2=c(2,:
);b1=c(3,:
);b2=c(4,:
);
d1=c(5,:
);d2=c(6,:
);d3=c(7,:
);
ea1=e(1,:
);ea2=e(2,:
);eb1=e(3,:
);eb2=e(4,:
);
ed1=e(5,:
);ed2=e(6,:
);ed3=e(7,:
);
figure
(2);%画第二个图形
i=1:
60;plot(i,a1,'r',i,a2,'r:
',i,b1,'b',i,b2,'b:
',i,d1,'g',i,d2,'g:
',i,d3,'g+')%画出各个被辨识参数
title('ParameterIdentificationwithRecursiveLeastSquaresMethod')
figure(3);i=1:
60;%画出第三个图形
plot(i,ea1,'r',i,ea2,'r:
',i,eb1,'b',i,eb2,'b:
',i,ed1,'g',i,ed2,'g:
',i,ed2,'r+')
title('IdentificationPrecision')
figure(4);subplot(4,1,1);%画出第四个图形,第一个子图
i=1:
60;plot(i,zs(i),'r')
subplot(4,1,2);i=1:
60;plot(i,z(i),'g')%第二个子图,画出被辨识系统的采样输出响应
subplot(4,1,3);i=1:
60;plot(i,zm(i),'b')%第三个子图,画出模型含有噪声的输出响应
subplot(4,1,4);i=1:
60;plot(i,zs(i),'b')%第四个子图,画出模型去除噪声后的输出响应
(1)程序执行结果:
u=
Columns1through17
1-1-1-1-1111-111-1-11-11-1
Columns18through34
-1-1-1111-111-1-11-11-1-1-1
Columns35through51
-1111-111-1-11-11-1-1-1-11
Columns52through60
11-111-1-11-1
v=
Columns1through10
0.7254-0.06310.7147-0.2050-0.12411.48971.40901.41720.6715-1.2075
Columns11through20
0.71721.63020.48891.03470.7269-0.30340.2939-0.78730.8884-1.1471
Columns21through30
-1.0689-0.8095-2.94431.43840.3252-0.75491.3703-1.7115-0.1022-0.2414
Columns31through40
0.31920.3129-0.8649-0.0301-0.16490.62771.09331.1093-0.86370.0774
Columns41through50
-1.2141-1.1135-0.00681.5326-0.76970.3714-0.22561.1174-1.08910.0326
Columns51through60
0.55251.10061.54420.0859-1.4916-0.7423-1.06162.3505-0.61560.7481
c=
Columns1through10
0.100000.10000.0348-0.0983-0.6239-0.4695-1.6520-1.8000-1.8000
0.100000.10000.10000.53580.52920.70291.43730.90000.9000
0.10000-0.0000-0.1590-0.07390.00550.14510.58640.80000.8000
0.100000.20000.06400.54590.81880.74850.29020.30000.3000
0.100000.17150.14950.2697-0.2741-0.27220.75961.00001.0000
0.100000.09370.19840.89040.92641.14640.70381.00001.0000
0.100000.17250.1716-0.4338-0.16140.14530.33010.40000.4000
Columns11through20
-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000
0.90000.90000.90000.90000.90000.90000.90000.90000.90000.9000
0.80000.80000.80000.80000.80000.80000.80000.80000.80000.8000
0.30000.30000.30000.30000.30000.30000.30000.30000.30000.3000
1.00001.00001.00001.00001.00001.00001.00001.00001.00001.0000
1.00001.00001.00001.00001.00001.00001.00001.00001.00001.0000
0.40000.40000.40000.40000.40000.40000.40000.40000.40000.4000
Columns21through30
-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000
0.90000.90000.90000.90000.90000.90000.90000.90000.90000.9000
0.80000.80000.80000.80000.80000.80000.80000.80000.80000.8000
0.30000.30000.30000.30000.30000.30000.30000.30000.30000.3000
1.00001.00001.00001.00001.00001.00001.00001.00001.00001.0000
1.00001.00001.00001.00001.00001.00001.00001.00001.00001.0000
0.40000.40000.40000.40000.40000.40000.40000.40000.40000.4000
Columns31through40
-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000
0.90000.90000.90000.90000.90000.90000.90000.90000.90000.9000
0.80000.80000.80000.80000.80000.80000.80000.80000.80000.8000
0.30000.30000.30000.30000.30000.30000.30000.30000.30000.3000
1.00001.00001.00001.00001.00001.00001.00001.00001.00001.0000
1.00001.00001.00001.00001.00001.00001.00001.00001.00001.0000
0.40000.40000.40000.40000.40000.40000.40000.40000.40000.4000
Columns41through50
-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000
0.90000.90000.90000.90000.90000.90000.90000.90000.90000.9000
0.80000.80000.80000.80000.80000.80000.80000.80000.80000.8000
0.30000.30000.30000.30000.30000.30000.30000.30000.30000.3000
1.00001.00001.00001.00001.00001.00001.00001.00001.00001.0000
1.00001.00001.00001.00001.00001.00001.00001.00001.00001.0000
0.40000.40000.40000.40000.40000.40000.40000.40000.40000.4000
Columns51through60
-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000-1.8000
0.90000.90000.90000.90000.90000.90000.90000.90000.90000.9000
0.80000.80000.80000.80000.80000.80000.80000.80000.80000.8000
0.30000.30000.30000.30000.30000.30000.30000.30000.30000.3000
1.00001.00001.00001.00001.00001.00001.00001.00001.00001.0000
1.00001.00001.00001.00001.00001.00001.00001.00001.00001.0000
0.40000.40000.40000.40000.40000.40000.40000.40000.40000.4000
e=
1.0e+004*
Columns1through10
000-0.0001-0.00040.0005-0.00000.00030.00000.0000
00000.0004-0.00000.00000.0001-0.00000.0000
00-0.00011.3455-0.0001-0.00010.00250.00030.0000-0.0000
000.0001-0.00010.00080.0000-0.0000-0.00010.0000-0.0000
000.0001-0.00000.0001-0.0002-0.0000-0.00040.00000.0000
00-0.00000.00010.00030.00000.0000-0.00000.0000-0.0000
000.0001-0.0000-0.0004-0.0001-0.00020.00010.0000-0.0000
Columns11through20
0.00000.00000.00000.00000.00000.00000.00000.00000.00000.0000
0.00000.00000.00000.00000.00000.00000.00000.00000.00000.0000
-0.00000.0000-0.0000-0.0000-0.0000-0.0000-0.00000.00000.00000.0000
0.0000-0.0000-0.00000.00000.0000-0.00000.0000-0.0000-0.00000.0000
-0.00000.00000.00000.00000.00000.00000.00000.0000-0.00000.0000
0.0000-0.0000-0.0000-0.0000-0.00000.00000.0000-0.00000.0000-0.0000
-0.00000.0000-0.0000-0.0000-0.0000-0.0000-0.00000.0000-0.00000.0000
Columns21through30
0.00000.00000.00000.0000-0.0000-0.00000.0000-0.0000-0.0000-0.0000
0.00000.00000.00000.0000-0.0000-0.00000.0000-0.0000-0.0000-0.0000
-0.0000-0.0000-0.0000-0.0000-0.00000.00000.00000.00000.0000-0.0000
-0.0000-0.0000-0.0000-0.00000.0000-0.00000.00000.00000.00000.0000
0.00000.00000.0000-0.00000.0000-0.00000.00000.00000.00000.0000
0.00000.0000-0.00000.00000.00000.0000-0.0000-0.00000.00000.0000
-0.0000-0.0000-0.0000-0.0000-0.00000.00000.00000.0000-0.00000.0000
Columns31through40
-0.00000.0000-0.0000-0.0000-0.00000.0000-0.0000-0.0000-0.00000.0000
-0.00000.0000-0.0000-0.0000-0.00000.0000-0.0000-0.0000-0.00000.0000
0.00000.00000.00000.00000.00000.00000.00000.00000.00000.0000
-0.0000-0.0000-0.00000.00000.00000.0000-0.00000.00000.0000-0.0000
-0.0000-0.00000.00000.00000.0000-0.00000.00000.0000-0.0000-0.0000
0.00000.00000.00000.00000.00000.00000.00000.00000.00000.0000
0.0000-0.00000.00000.00000.00000.0000-0.00000.00000.0000-0.0000
Columns41through50
-0.0000-0.00000.0000-0.0000-0.00000.00000.0000-0.0000-0.0000-0.0000
-0.00000.00000.0000-0.0000-0.00000.00000.0000-0.0000-0.0000-0.0000
-0.0000-0.00000.0000-0.00000.00000.00000.0000-0.00000.00000.0000
0.0000-0.0000-0.0000-0.0000-0.0000-0.0000-0.00000.00000.00000.0000
0.00000.0000-0.00000.0000-0.0000-0.0000-0.00000.00000.0000-0.0000
-0.00000.00000.00000.00000.00000.00000.0000-0.0000-0.00000.0000
0.00000.00000.0000-0.00000.0000-0.0000-0.00000.0000-0.0000-0.0000
Columns51through60
-0.0000-0.0000-0.00000.0000-0.0000-0.0000-0.00000.0000-0.0000-0.0000
-0.00000.00000.00000.0000-0.0000-0.0000-0.0000-0.0000-0.0000-0.0000
0.00000.00000.00000.00000.0000-0.0000-0.0000-0.0000-0.00000.0000
0.0000-0.00000.00000.0000-0.00000.0000-0.00000.0000-0.0000-0.0000
-0.00000.00000.0000-0.00000.00000.00000.00000.0000-0.00000.0000
-0.00000.00000.00000.00000.00000.00000.0000-0.00000.0000-0.0000
0.00000.00000.00000.0000-0.00000.00000.0000-0.0000-0.00000.0000
z=
Columns1through10
07.446530.7858-28.7654-10.23399.9215-4.8162-6.266817.98170
016.669827.1989-38.6759-1.25716.4731-9.2722-6.014514.87590
0.441822.834822.0320-44.45736.48466.2759-11.0952-3.019910.80330
0.179926.378114.0638-45.129113.83927.2537-11.91153.94317.63030
-1.217129.89384.6047-40.575118.15016.5658-11.117212.985900
-2.169131.9745-6.0426-30.573618.34504.3079-8.750318.537800
0.540131.7254-17.9814-19.658115.04510.6483-6.906919.981300
Columns11through20
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
00000
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 增广 最小 辨识 噪声 有色 区别 是什么 剖析