clear all clc k=0;syms n; num=input('enter system numerator :\n\n'); den=input('enter system denominator :\n\n'); [q,r]=deconv(den,[1 0]); if length(num)>length(den) disp('Type do not define for this system!') else if r==0 q=den;r=0; for n=0:100 [q,r]=deconv(q,[1 0]); if r==0 k=k+1; else break end end fprintf('\nthe type of this system is %d\n\n',k) else fprintf('\nthe type of this system is %d\n\n',0) end end %%steady state error to your inputs disp('---------------------------------------------------'); fprintf('steady state error to your inputs : \n\n\n '); fnum=input('enter feeedback numerator ,H(s):\n\n'); fden=input('enter feeedback denominator ,H(s) :\n\n'); s=tf('s'); g=tf(num,den); h=tf(fnum,fden); %% for unit step input : u=1/s disp('---------------------------------------------------'); gh=g*h; kp=dcgain(gh); fprintf('\n steady state error to unit step input is %d\n\n',1/(1+kp)) %% for unit ramp input :u=1/s^2 disp('---------------------------------------------------'); sgh=s*g*h; kv=dcgain(sgh); fprintf('\n steady state error to unit ramp input is %d\n\n',1/(kv)) %% for unit parabola input :u=1/s^3 disp('---------------------------------------------------'); ssgh=s*sgh; ka=dcgain(s*sgh); fprintf('\n steady state error to unit parabola input is %d\n\n',1/(ka)) disp('---------------------------------------------------');