资 源 简 介
clear;close all;
%----------------设定计算步数和精度----------------%
step=1000; %步数
err=0.00001; %精度
eps1=0.001;
%----------------数据生成----------------%
k0=0:step+1;
%u=sin(2*pi.*k0/step*10);
u=rand(1,step+2)*2-1;
y=zeros(1,step+2);
y(1)=0;
y(2)=0;
for t=1:step
y(t+2)=y(t+1)*y(t)*(y(t+1)-2.5)/(1+y(t+1)*y(t+1)+y(t)*y(t))+u(t+1);
end
%----------------绘制输入及输出信号波形----------------%
figure(1);
plot(y(3:step+2),"r");
hold;
plot(u(2:step+1),"g");%pause
legend("输出y","输入u");
%----------------初始化隶属函数----------------%
c=[-4,-3,-2,-1,0,1];
U=zeros(6,step+2);
for t=1:step+2
if(y(t)<=c(