Use matlab to plot the step response of the position servo


Use MATLAB to plot the step response of the position servo system for values of the gain K=0.5, 1.0, 2.0 below is possible data code

Code 2 for Project:

EDU>> K1=[0.5,1.0,2.0];

EDU>> t=0:0.01:150;

EDU>>  fori=1:1:length(K1)K=K1(i);

title Text=mymintf('K=%1.4f',K);

wn=sqrt(0.2*K);

num=[wn^2];

den=[1,0.104,wn^2];

zeta=0.104/2/wn;

sys=tf(num,den);

y=step(sys,t);

% Finding maximum overshoot

if zeta<1 Mp=(max(y)-1)*100;

overshoot Text=mymintf('Max overshoot=%3.2f%',Mp);

else overshoot Text=mymintf(' No overshoot');

end

% Finding rise time

idx_01=max(find(y<0.1));

idx_09=min(find(y>0.9));

t_r=t(idx_09)-t(idx_01);

risetime Text=mymintf('Rise time=%3.2f sec',t_r);

% Plotting

subplot(t,y);

grid on;

title(titleText);

text(0.5,0.3,overshootText);

text(0.5,0.1,risetimeText);

end

Solution Preview :

Prepared by a verified Expert
MATLAB Programming: Use matlab to plot the step response of the position servo
Reference No:- TGS01150613

Now Priced at $15 (50% Discount)

Recommended (91%)

Rated (4.3/5)