0% found this document useful (0 votes)
52 views

MATLAB code-WPS Office

This MATLAB code simulates a closed-loop control system and designs a compensator. It calculates the open-loop transfer function as G, then determines the closed-loop transfer function T using negative unity feedback. Step responses and a root locus plot are generated. A lead-lag compensator Gc is then designed, and the compensated closed-loop transfer function T1 and its step response are obtained.

Uploaded by

sadia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

MATLAB code-WPS Office

This MATLAB code simulates a closed-loop control system and designs a compensator. It calculates the open-loop transfer function as G, then determines the closed-loop transfer function T using negative unity feedback. Step responses and a root locus plot are generated. A lead-lag compensator Gc is then designed, and the compensated closed-loop transfer function T1 and its step response are obtained.

Uploaded by

sadia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

MATLAB code

eding in given parameter values.

JI = 10;

BI = 1;

k = 100;

Jm = 2;

Bm = 0.5;

pm = [ Jm Bm k];

pl = [ JI BI k];

s= tf('s');

%Part 1

%Finding Open Loop Transfer Function of

system.

G1 = tf ( [0 k], pl);

G2 = tf ( [01], pm);

G3 = G1 G2;

%OpenLoop TransferFunction G(s)=

disp('Open Loop Transfer Function')

G3/(1-G3* k) % As k is with Positive G =

feedback,

%step response

figure (1)

step(G)
title('step response of open loop system')

%Part 2

figure (2)

rlocus(G)

title('root loci plot')

%Part 3

disp('Closed Loop Transfer Function')

T= feedback (G,1) %Negative unity

feedback

figure (3)

step(T)

title ('Step response of Closed Loop

system')

% System characteristics

disp('Time domain specifications of closed

loop system') stepinfo (T)

signing a lead-lag compensator for

Open Loop Transfer Function

Gc= 7.1264*((1+1.8*s)*

(1+0.052*s))/((1+0.1*s)*(1+0.64*s));

%Open Loop systtem with compensator

G4= G*GC;

figure (4)

rlocus (G4)
title ('Root Loci of compensated system') %step response of compensated closed

loop system

T1 = feedback (G4,1)

figure (5)

step (T1)

title ('step response of compensated closed

loop system') RESULT(S)

Open Loop Transfer Function

G=

2000 s^4 + 700 s^3 +120050 s^2 + 15000 s+ 1e0675

+400 s^8 + 280 s^7 + 48069 s^6 +22807 s^5 + 1.643e06 s^4 + 430150 s^3 + 1.203e07 s^2 + 1.5e06 s

Continuous-time transfer function. Closed Loop Transfer Function T =

2000 s^4 + 700 s^3 +120050 s^2 + 15000 s + 1e06

400 s^8+ 280 s^7 + 48069 s^6 +22807 s^5 + 1.645e06 s^4 + 430850 s^3 + 1.215e07 s^2 +1.515e06 s +
1e06

Continuous-time transfer function.

Time domain specifications of closed loop system

ans =

struct with fields:

RiseTime: 4.2408

Settling Time: 58.9041

SettlingMin: 0.7510

SettlingMax: 1.4992

Overshoot: 49.9168

Undershoot: 0
Peak: 1.4992

PeakTime: 11.0642

T1 =75+1334 s^6 +2.686e04 s^5 +1.036e05 s^4 + 1.599e06 s^3 + 1.721e06 s^2 + 1.33e07 s +7.126e06

25.6 s^10+ 313.9 s^9 + 3684 s^8 +

3.731e04 s^7+ 1.715e05 s^6 + 1.293e06 s^5 +2.835e06 s^4 + 1.103e07 s^3 + 1.486e07 s^2 + 1.48e07 s +
7.126e06

Continuous-time transfer function.

PLOT(S)
.

You might also like