资源简介

输入系统阶跃响应数据以及采样时间,即可得到该控制系统的稳态时间,衰减率,波峰时间,终值等。

资源截图

代码片段和文件信息

function [tsMpfaitrtpystext]= value(ydt)
[lpm]=size(y);
if lp    lp=m;
end
type=0;
length=fix(lp/20);
temp=0;
for i=lp:-1:lp-length+1
    temp=temp+y(i);
end;
temp=temp/length;
error=zeros(1length);
for i=lp:-1:lp-length
    error(lp-i+1)= abs(y(i)-temp);
end
test=0;
for i=1:lp-1
    if(y(i+1)        test=test+1;
    end
end
ys=0;
[emaxte]=max(error);

if abs(emax)> 0.02*abs(temp)
    type=3;
    fai=-1;
    Mp=-1;
    ts=-1;
    tr=-1;
    tp=-1;
    ys=0;
elseif test<=5
    type=1;
    ys=y(lp);
else
    type=2;
    ys=y(lp);
end


if type==1     % alwarys increase
    fai=0;
    Mp=0;
    tp=dt*lp;
    i=lp;
    while y(i)>ys*0.9500
        i=i-

评论

共有 条评论