⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bcdatayz719.m

📁 利用MATLAB仿真设计的补偿器
💻 M
字号:
%该程序作用 验证得到的补偿器的 实验数据的动态性能指标改善情况
clc;
clear all;

t1=0:0.0004:(2500-1)/2500;  

%得到的补偿器
%num_bcls=[1.72324875424906, 814.537446621735e-003,817.282130197855e-003,-3.08914053804197];
%den_bcls =[1,-323.525065672951e-003,-425.745531493248e-003,14.8980165435619e-003];
%num_bcls =[0, 52.4620448021109, -154.265116774790,151.273343074920,   -49.4674643307803];
%den_bcls =[1, -1.92367958183330, 926.486353282913e-003,0,0];
%num_bcls =[0,3.23500237279238e+003,-9.41920182281996e+003,9.14222552378969e+003,-2.95786477649789e+003];
%den_bcls =[1,-841.766872499185e-003,0,0,0];
%num_bcls =[0,3.53265034176112e+003   -10.2880202276077e+003,9.98710646051526e+003,-3.23158158993027e+003];
%den_bcls =[1, -848.307129911760e-003 ,0,0,0];
%num_bcls =[0, 2.84605815253414e+003,-8.28650107019543e+003,8.04282738287696e+003, -2.60222807637757e+003];
%den_bcls =[1,-846.404388558331e-003,0,0,0];
%num_bcls =[0,12.4681507839499,-34.860393154949,32.4458804040732,-10.0508196341084];
%den_bcls =[1,-1.93144112295538,934.259521853935e-003,0,0];%阻尼比0.63所设计出的补偿器
%num_bcls =[0,12.4179976757876, -34.7204268630189,32.3158707916513,-10.0106348725536];
%den_bcls =[1,-1.92368138547642,926.488117416758e-003,0,0];%阻尼比0.707所设计出的补偿器
num_bcls =[0, 12.4882719461133,-34.9167289011179,32.4983929665838, -10.0671131626925];
den_bcls =[1,-1.93443177563199,937.254624494857e-003,0,0];%阻尼比0.6所设计出的补偿器
 
%传感器输出的实验数据
fp=fopen('liu17.txt','r');
out=fscanf(fp,'%f',2500);
fclose(fp);
for i=1:2500
    y(i)=out(i)-0.94456;%1000average
end
[b,a]=butter(2,0.01);
y_17=filter(b,a,y)';

u_bc17=filter(num_bcls,den_bcls,y_17);

idx1_17=find(y>=781.992724950097e-003,1)
idx2_17=find(u_bc17>=781.992724950097e-003,1)

t17=t1*1000-484;
figure(2)
[os,ts,tr]=stepspecs(t17,u_bc17,5)
xyh_plotms
axis([0,200,-0.5,3]);
title('flux=17g/s,补偿后ts')

figure(3)
[os,ts,tr]=stepspecs(t17,y_17,5)
xyh_plotms
axis([0,200,-0.5,3]);
title('flux=17g/s,补偿前ts')
% *************************************32g/s
t32=t1*1000-498;
fp=fopen('liu32.txt','r');
out=fscanf(fp,'%f',10000);
fclose(fp);
for i=1:2500
    y32(i)=out(i)-0.94472;
end
[b,a]=butter(2,0.012);
y_32=filter(b,a,y32)';
u_bc32=filter(num_bcls,den_bcls,y_32);

figure(4)
[os,ts,tr]=stepspecs(t32,u_bc32,5)
xyh_plotms
axis([0,200,-0.5,3]);
title('flux=32g/s,补偿后ts')

figure(5)
[os,ts,tr]=stepspecs(t32,y_32,5)
xyh_plotms
axis([0,200,-0.5,3]);
title('flux=32g/s,补偿前ts')

%t32=t32-40;

idx1_32=find(y>= 1.11764895697486,1)
idx2_32=find(u_bc32>= 1.11764895697486,1)
%*******************************************************************64
t64=t1*1000-434;
fp=fopen('liu64.txt','r');
out=fscanf(fp,'%f',10000);
fclose(fp);
for i=1:2500
    y64(i)=out(i)-0.94296;
end
[b,a]=butter(2,0.012);
y_64=filter(b,a,y64)';
u_bc64=filter(num_bcls,den_bcls,y_64);

idx1_64=find(y_64>=1.48648022290613,1)
idx2_64=find(u_bc64>=1.48648022290613,1)

figure(6)
[os,ts,tr]=stepspecs(t64,u_bc64,5)
xyh_plotms
axis([0,200,-0.5,3]);
title('flux=64g/s,补偿后ts')

figure(7)
[os,ts,tr]=stepspecs(t64,y_64,5)
xyh_plotms
axis([0,200,-0.5,3]);
title('flux=64g/s,补偿前ts')

%************************************************************77
t77=t1*1000-434;
fp=fopen('liu77.txt','r');
out=fscanf(fp,'%f',10000);
fclose(fp);
for i=1:2500
   y77(i)=out(i)-0.9435;
end
[b,a]=butter(2,0.012);
y_77=filter(b,a,y77)';
u_bc77=filter(num_bcls,den_bcls,y_77);
idx1_77=find(y_77>=1.63927743009267,1)
idx2_77=find(u_bc77>=1.63927743009267,1)

figure(8)
[os,ts,tr]=stepspecs(t77,u_bc77,5)
xyh_plotms
axis([0,200,-0.5,3]);
title('flux=77g/s,补偿后ts')

figure(9)
[os,ts,tr]=stepspecs(t77,y_77,5)
xyh_plotms
axis([0,200,-0.5,3]);
title('flux=77g/s,补偿前ts')

%t77=t77-40;
for i=1:100
    u_bc77(i)=u_bc77(2400+i);
end


%传感器输出的实验数据***********************************50
t50=t1*1000-468.4;
fp=fopen('liu50.txt','r');
out=fscanf(fp,'%f',2500);
fclose(fp);
for i=1:2500
   y(i)=out(i)-0.94404;
end
%y = wden(y,'heursure','s','one',5,'db5'); %  改为小波滤波
[b,a]=butter(2,0.012);% 滤波后的实验数据
y=filter(b,a,y);
y_50=y';

u_bc50=filter(num_bcls,den_bcls,y_50);
idx1_50=find(y_77>=1.34868099490512,1)
idx2_50=find(u_bc77>=1.34868099490512,1)

figure(10)
[os,ts,tr]=stepspecs(t50,u_bc50,5)
xyh_plotms
axis([0,200,-0.5,3]);
title('flux=50g/s,补偿后ts')

figure(11)
[os,ts,tr]=stepspecs(t50,y_50,5)
xyh_plotms
axis([0,200,-0.5,3]);
title('flux=50g/s,补偿前ts')

figure(1)
plot(t17,y_17,'k',t17,u_bc17,'r',t32,y_32,'k',t32,u_bc32,'r',t64,y_64,'k',t64,u_bc64,'r',t77,y_77,'k',t77,u_bc77,'r',t50,y_50,'k',t50,u_bc50,'r')%,
xyh_plotms
axis([0,200,-0.5,3]);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -