step2trsfun.m

来自「用matlab实现motor运动控制的控制器设计仿真」· M 代码 · 共 41 行

M
41
字号
function G=step2trsfun(x0,yter,t1,t2,td)
% Input:
%    x0-The value of Step input;
%    yter-The stable value of step response;
%    t1-The time at of value 0.4 of unitary step response;
%    t2-The time at of value 0.8 of unitary step response;
%    td-Time delay.
%Output:
%    G-Transfer function of the system.
k=yter/x0;
lmd=t1/t2;
if lmd<=0.39
    n=1;
   elseif lmd>0.39&lmd<=0.49
    n=2;    
elseif lmd>0.49&lmd<=0.55
    n=3;    
elseif lmd>0.55&lmd<=0.60
    n=4;    
elseif lmd>0.60&lmd<=0.63
    n=5;    
elseif lmd>0.63&lmd<=0.66
    n=6;    
elseif lmd>0.66&lmd<=0.67
    n=7;    
elseif lmd>0.67&lmd<=0.69
    n=8;    
elseif lmd>0.69&lmd<=0.72
    n=10;    
elseif lmd>0.72&lmd<=0.74
    n=12;    
elseif lmd>0.74&lmd<=1
    n=14; 
    elseif lmd>1
        error('Input arguments error:t1 should be less than t2 and is positive')
end
T=n*(t1+t2)/2.16;
s=tf('s');
G=k*exp((-td*s))/(T*s+1)^n;

⌨️ 快捷键说明

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