You are on page 1of 21

PROGRAM 1: Write a program using MATLAB to plot pole zero map while transfer function is given.

THEORY: Transfer function is defined as the ratio of the Laplace transform of output to the Laplace transform of input. Hence roots of the numerator polynomial are termed as zeros because these values of s make the transfer function zero. Similarly roots of the denominator polynomial are termed as poles because these values of s make the transfer function infinite. If all poles and zeros lie in the L.H.S. part of the S-plane then system is stable ;if any one of them lies in R.H.S. then system becomes unstable.

ALGORITHM: Step1: Create matrices that contain all the coefficients of the numerator polynomial. Step2: Create matrices that contain all the coefficients of the numerator polynomial. Step3: Make the transfer function in terms of s using command sys= tf(num,den).). Step4Now we have to plot pole zero on figure window so use command pzmap(sys

PROGRAM: p1=input('enter the numerator matrix') q1=input('enter the denomenator matrix') sys=tf(p1,q1) pzmap(sys)

OUTPUT:
Pole-Zero Map 2.5 2 1.5 1 0.5 0 -0.5 -1 -1.5 -2 -2.5 -4

Imaginary Axis

-3.5

-3

-2.5

-2 Real Axis

-1.5

-1

-0.5

Enter the numerator matrix : [8 56 96] P1 = 8 56 96

Enter the denominator matrix: [1 4 9 10 0] Q1 = 1 4 9 10 0

Transfer function: (8s2+56 s+96)/(s4+4s3+9s2+10s)

PROGRAM 2 Write a program using MATLAB to find the transfer function while block diagram is given.
THEORY: Transfer function is defined as the ratio of the Laplace transform of output to the Laplace transform of input. The block diagram is a tool which represent the any system and by using block diagram reduction we find the transfer function by using some rules such as: Series connection: when two are more block are connected in series then multiplied both

Parallel: when two are more block are connected in parallel then both are added

Feedback block: when the blocks are connected in feedback

ALGORITHM: Step1: Create matrices that contain all the coefficients of the numerator polynomial. Step2: Create matrices that contain all the coefficients of the numerator polynomial. Step3: Make the transfer function in terms of s using command sys= tf(num,den)

PROGRAM: clc; n1=[4]; d1=[1 4 0]; printsys(n1,d1) n2=[1 1.2]; d2=[0 1]; printsys(n2,d2) n3=[1 0.8]; d3=[0 1]; printsys(n3,d3) [n4,d4]=cloop(n1,d1,-1) printsys(n4,d4) [n5,d5]=parallel(n2,d2,n3,d3) printsys(n5,d5) [n6,d6]=feedback(n4,d4,n5,d5,-1) printsys(n6,d6) OUTPUT: num/den = 4/(s2+4) num/den = (s +1.2)/1 num/den = (s+0.8)/1 n4 = d4 =1 0 4 0 4 4

num/den = 4/(s2+4s+4) n5 = d5 = 0 0 2 0 2 1

num/den = (2s+2)/1 n6 = d6 = 0 0 0 0 1 0 12 0 1 4

num/den = 4/(s2+12s+12)

PROGRAM 3 WRITE A MATLAB PROGRAM TO FIND TIME RESPONSE FOR A GIVEN TRANSFER FUNCTION.

THEORY:

Time response analysis is transient response and steady state response of the 1st order control system. Transient response of any system is that varies with time while steady state response is independent of time. Output becomes constant irrespective of time.

ALGORITHM: Step1: Create a matrices that contain all the coefficients of the numerator polynomial. Step2: Create a matrices that contain all the coefficients of the numerator polynomial. Step3: Make the transfer function in terms of using command sys= tf(num,den). Step4: Now we have to analyse the time response of the system named sys1 so we load LTI Viewer. Step5: Now we will import the data of the system in LTI viewer whose analysis is to be done. PROGRAM: p1=input('enter the numerator matrix') q1=input('enter the denomenator matrix') sys1=tf(num,den) load ltiexamples ltiview

OUTPUT:

S pR sp n te e o se 1 .4

1 .2

Amplitude

0 .8

0 .6

0 .4

0 .2

0 0

5 T e(se im c)

1 0

PROGRAM 4 WRITE A MATLAB PROGRAM TO FIND 1.RISE TIME 2.PEAK OVERSHOOT FOR A GIVEN TRANSFER FUNCTION.
THEORY: Rise time : it is the time required for the response to rise from 10% to 90% of the final value for over damped system. And 0% to 100% of the final value for underdamped system. Delay time: it is the time required for the response to reach 50% of the final value. Peak overshoot: it is the largest error between the reference input and output during transient period

ALGORITHM: Step 1: Create a matrices that contain all the coefficients of the numerator polynomial. Step 2: Create a matrices that contain all the coefficients of the numerator polynomial. Step 3: Make the transfer function in terms of s using command tf(num,den) sys=

STEP 4: Then find the closed loop transfer function using command= CLOOP (num,den-1). STEP 5: Now use printsys command that print the transfer function PROGRAM: [n3]=[1 2]; [d3]=[1 1 0]; printsys(n3,d3) [n4,d4]=cloop(n3,d3,-1)

printsys(n4,d4) step(n4,d4);

OUTPUT:

Step Response 1.4

1.2

Amplitude

0.8

0.6

0.4

0.2

3 Time (sec)

PROGRAM 5 WRITE A MATLAB PROGRAM FOR PLOTTING CONTINUOUS AND DISCRETE SQUARE WAVE HAVING FREQUENCY=50Hz AND DUTY CYCLE 50%.

PROGRAM: clc; %Generation of square wave f=50; d=50;%fundamental frequency f,duty cycle in percentage d fs=1000;%sampling frequency fs t=0:1/fs:0.1;%sampling time 0 to 0.1 second at interval of 1/fs v=square(2*pi*f*t,d);%generates square wave using in built function plot(t,v); axis([0 0.1 -1.2 1.2]);%defining axis xlabel('time in second'); ylabel('amplitude'); title('continuous plot of square wave,duty cycle 50%,f=50 Hz ,fs=1000 Hz') figure stem(t,v);%discrete plot axis([0 0.1 -1.2 1.2]);%again defining axis xlabel('time samples ');

ylabel('amplitude'); title('discrete plot,sq.wave duty cycle 50%,f=50 Hz,fs=1000Hz')

OUTPUT:

d iscre p t,sq a e d ty cycle 5 % 0 H te lo .w v u 0 ,f=5 z,fs=1 0 H 00 z 1 0 .8 0 .6 0 .4 amplitude 0 .2 0 -0 .2 -0 .4 -0 .6 -0 .8 -1 0 0 1 .0 0 2 .0 0 3 .0 0 4 .0 0 5 .0 0 6 .0 tim sa p s e m le 0 7 .0 0 8 .0 0 9 .0 0 .1

continuous plot of square w e,duty cycle 50% av ,f=50 H ,fs=1000 H z z 1 0.8 0.6 0.4 amplitude 0.2 0 -0.2 -0.4 -0.6 -0.8 -1 0 0.01 0.02 0.03 0.04 0.05 0.06 tim in second e 0.07 0.08 0.09 0.1

PROGRAM 6 WRITE A MATLAB PROGRAM AND DRAW BODE PLOT FOR THE GIVEN TRANSFER FUNCTION AND DETERMINE PHASE MARGIN ANG GAIN MARGIN.

THEORY: Bode plot consist of two plot, first one is the phase plot other is magnitude plot. Ths plot is introduced in practice to overcome the root locus techniques, it reduces the complexity of finding the stability of the system

ALGORITHM: Step 1: Create a matrices that contain all the coefficients of the numerator polynomial. Step 2: Create a matrices that contain all the coefficients of the numerator polynomial. Step 3: Make the transfer function in terms of s using command tf(num,den) Step 4: now use the BODE(sys5) command that plots the required bode plot sys=

PROGRAM: clc; num= input('enter the numerator matrix')

den=input('enter the denomenator matrix')


sys5=tf(num,den) bode(sys5) clc; num=[2 0.5] den=[1 1.5 0.5 0 0]

sys5=tf(num,den) margin(sys) OUTPUT:

Bd Dg m oe i r aa 10 0 M g itu e (d ) a n d B 5 0 0 -0 5 -0 10 -5 10 -3 15 P a h se (d g e )

-8 10

-2 25

-7 20 1 0
2

1 0

1 0

1 0

1 0

F qec (a/ e) r uny r d c e s

Bd D g m o e ia ra G =-2 .6d (a 0 5 ra /s c , P =-3 .7d g(a 1 2ra /s c m 0 B t .3 4 d e ) m 6 e t .1 d e ) 10 0 M agnitude (dB) 5 0 0 -5 0 -1 0 0 -1 0 5 -1 5 3 Phase (deg) Ss ms s y te : y 5 F q e c (ra Ss): 0s 5 re u n y d yc m 5 5 /s te : y e .3 s re Mg itu e(d ): 2 q e c (ra /s c 1 8 a n d BF0 u n y d e ): .0 .5 Mg itu e( B 0 a n d d ): .6

-1 0 8 Ss ms s y te : y 5 F q e c (ra /s c 0 5 re u n y d e ): .3 9 Pa e(d g -1 0 h s e ): 8 Ss ms s y te : y 5 F q e c (ra /s c 1 4 re u n y d e ): .1 Pa e(d g -2 8 h s e ): 1


-2

-2 5 2

-2 0 7 1 0 1 0
-1

1 0

1 0

1 0

F q e c (ra /s c re u n y d e )

PROGRAM 7 WRITE A MATLAB PROGRAM AND DRAW NYQUIST PLOT FOR THE GIVEN TRANSFER FUNCTION .

PROGRAM: clc; n1=50; d1=[1 3 2] sys7=tf(n1,d1) load ltiexamples ltiview

OUTPUT:

N yquist D iagram 20

15 System sys7 : R 7.96 eal: Im 15.6 ag: Frequency (rad/sec): -0.847

10 System sys7 : P hase M argin (deg): 24.4 D elay M argin (sec): 0.0619 At frequency (rad/sec): 6.89 C losed Loop Stable? Yes

Imaginary Axis

-5

-10

-15

-20 -5

10 R Axis eal

15

20

25

PROGRAM 8 WRITE A MATLAB PROGRAM AND DRAW ROOT LOCUS FOR THE GIVEN TRANSFER FUNCTION.
PROGRAM: clc; n1=1; d1=[1 4 3 0] sys8=tf(n1,d1) rlocus(sys8)

OUTPUT:

Root Locus 10 8 6 4 2 0 -2 -4 -6 -8 -10 -12

Imaginary Axis

-10

-8

-6

-4 Real Axis

-2

PROGRAM 9 WRITE A MATLAB PROGRAM TO GENERATE AM WAVEFORM FOR:


THEORY: Under modulation Critical modulation Over modulation

PROGRAM: clc; clear all; am=input('enter the amplitude of the message signal'); ac=input('enter the amplitude of the carrier signal'); fm=input('message frequency'); fc=input('carrier frequency');

m=am/ac; t=linspace(0,1,100*fc); e=ac+am*cos(2*pi*fm*t); u=e.*(cos(2*pi*fc*t)); hold on; plot(t,u); plot(t,e,'r'); plot(t,-e,'r'); hold off; title('AM WAVE FORM');

OUTPUT:
AE MO W AM V F R 3

3 0

0 . 1

0 . 2

0 . 3

0 . 4

0 . 5

0 . 6

0 . 7

0 . 8

0 . 9

AVM MF W AR E O 1 . 5

0 . 5

0 . 5

1 . 5

0 . 1

0 . 2

0 . 3

0 . 4

0 . 5

0 . 6

0 . 7

0 . 8

0 . 9

A AF M ER WO V M 2 1 . 5 1 0 . 5 0 -5 0 . 1 -5 1 . 2 0

0 . 1

0 . 2

0 . 3

0 . 4

0 . 5

0 . 6

0 . 7

0 . 8

0 . 9

PROGRAM 10 Periodic waveform generation

TO GENERATE THE FOLLOWING PERIODIC WAVEFORMS OF FREQUENCY 50HZ FOR 5 CYCLES. Sine waveform Saw tooth waveform Square waveform

THEORY: Sine wave at define as a peak to peak frequency and we are generate awave form is called sine wave. Saw tooth wave form as we define as a triangular pulse is called a saw tooth waveform. As well as square waveform generate a square pulse (byselting pulse) is called square waveform.

PROGRAM:

%SINUSOIDAL WAVEFORM f=1000 t=0:1/f:.1 x=sin(2*pi*50*t) subplot(311) plot(t,x) axis([0 .1 -1.5 1.5]) xlabel('---------->time');ylabel('------->amplitude'); title('sinusoidal waveform'); grid

%SAWTOOTH WAVEFORM f=10000 t=0:1/f:0.1 x=sawtooth(2*pi*50*t,1) subplot(312) plot(t,x) axis([0 .1 -1.5 1.5])

xlabel('---------->time');ylabel('------->amplitude'); title('sawtooth waveform'); grid

%SQUARE WAVEFORM f=30000 t=0:1/f:0.1 x=square(2*pi*50*t,80) subplot(313) plot(t,x) axis([0 .1 -1.5 1.5]) xlabel('---------->time');ylabel('------>amplitude'); title('square waveform'); grid

OUTPUT:

sinusoidal waveform ------->amplitude 1 0 -1 0 0.01 0.02 0.03 0.04 0.05 0.06 ---------->time sawtooth waveform 0.07 0.08 0.09 0.1

------->amplitude

1 0 -1 0 0.01 0.02 0.03 0.04 0.05 0.06 ---------->time square waveform 0.07 0.08 0.09 0.1

------>amplitude

1 0 -1 0 0.01 0.02 0.03 0.04 0.05 0.06 ---------->time 0.07 0.08 0.09 0.1

You might also like