Control Ssytem Lab Manual
Control Ssytem Lab Manual
1
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
ylabel('text','Property1',PropertyValue1,'Property2',PropertyValue2,...) sets the values of the
specified properties of the ylabel.
H = ylabel(...) returns the handle to the text object used as the label.
exp Exponential.
exp(X) is the exponential of the elements of X, e to the X. For complex Z=X+i*Y, exp(Z) =
exp(X)*(COS(Y)+i*SIN(Y)).
cos Cosine.
cos(X) is the cosine of the elements of X.
sin Sine.
sin(X) is the sine of the elements of X.
WHILE expression
statements
END
The statements are executed while the real part of the expression has all non-zero elements.
The expression is usually the result of expr rop expr where rop is ==, <, >, <=, >=, or ~=.
2
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 01
AIM: - To write a MATLAB program for the Matrix Operation like Addition, Subtraction,
Multiplication and Division using If Else Statement.
PROCEDURE:-
Open MATLAB
Open new M-file
Type the program
Save in current directory
Compile and Run the program
For the output see command window\ Figure window
PROGRAM:-
clear all
% Matrix operation Using ifelse
function[]=exp1()
a= input('Enter the first Matrix Like [a b c; d e f; g h i] \n a = ')
b=input ('Enter the Second Matrix Like [a b c; d e f; g h i] \n b = ')
i='y';
while(i=='y')
c= input('Press \n 1. Addition \n 2. Multiplication \n 3. Subtarction \n 4. Exit \n Enter your
choice......... ');
if (c==1)
d=a+b;
elseif(c==2)
d=a*b;
elseif(c==3)
d=a-b;
elseif (c==4)
break;
else
display('Wrong choice')
end
display('Answer will be \n')
d
i=input('Do you want to cont......? \n Press (y/n)', 's');
end
OUTPUT:
>> exp1
3
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
1 2 3
4 5 6
7 8 9
b=
1 3 5
2 4 6
7 9 11
Press
1. Addition
2. Multiplication
3. Subtraction
4. Exit
Answer will be
d=
2 5 8
6 9 12
14 17 20
Press (y/n)
Experiment No: - 02
4
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Syntax used in program:
disp(X) displays the array, without printing the array name. In all other ways it's the same as
leaving the semicolon off an expression except that empty arrays don't display. If X is a string,
the text is displayed.
fliplr(X) returns X with row preserved and columns flipped in the left/right direction.
X = 1 2 3 becomes 3 2 1
456 654
SWITCH switch_expr
CASE case_expr,
statement, ..., statement
CASE {case_expr1, case_expr2, case_expr3,...}
statement, ..., statement
...
OTHERWISE,
statement, ..., statement
END
Experiment No: - 02
5
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
AIM: - To write a MATLAB program for Generating different type of waveform using Switch
Statement.
PROCEDURE:-
Open MATLAB
Open new M-file
Type the program
Save in current directory
Compile and Run the program
For the output see command window\ Figure window
PROGRAM:-
clear all
function[]=exp2()
a=input('Enter the range of the cycle or Enter X-Axis Range for the Waveform \n a = ');
i='y';
while(i=='y')
b=input('Press ....\n 1.Sine Waveform \n 2.Cosine Waveform \n 3.Exp. Waveform \n 4.Unit Step
Signal \n 5.Ramp Signal \n 6.Exit \n Enter Your Choice.......');
t=-a*pi:0.1:a*pi;
t1=0:1:a-1;
switch(b)
case 1
f=sin(t);
a1=plot(t,f)
xlabel('Time')
ylabel('sin(t)')
grid
title('Sine Waveform')
case 2
f=cos(t);
a2=plot(t,f)
xlabel('Time')
ylabel('cos(t)')
grid
title('Cosine Waveform')
case 3
b=input('enter the value of b for e^bt \n b = ');
f=exp(b*t);
6
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
a3=plot(t,f)
xlabel('Time')
ylabel('exp(b*t)')
grid
title('Exp. Waveform')
case 4
f=ones(1,a);
a4=plot(t1,f)
xlabel('Time')
ylabel('u(t)')
grid
title('Unit step signal')
case 5
a5=plot(t1,t1)
xlabel('Time')
ylabel('r(t)')
grid
title('Ramp Signal')
case 6
break;
otherwise
display('Wrong Choice')
end
i=input('Do you want to cont...... ? \n Press (y/n)', 's');
end
OUTPUT:
>> exp2
Enter the range of the cycle or Enter X-Axis Range for the Waveform
a= 2
Press....
1. Sine Waveform
2. Cosine Waveform
3. Exp. Waveform
4. Unit step Signal
5. Ramp Signal
6. Exit
7
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Press (y/n)
8
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 03
R = INPUT('What is your name','s') gives the prompt in the text string and waits for
character string input. The typed input is not evaluated; the characters are simply
returned as a MATLAB string.
The text string for the prompt may contain one or more '\n'. The '\n' means skip to the
beginning of the next line. This allows the prompt string to span several lines. To output
just a '\' use '\\'.
PZMAP(SYS) computes the poles and (transmission) zeros of the LTI model
SYS and plots them in the complex plane. The poles are plotted as x's and the zeros
are plotted as o's.
[P,Z] = PZMAP(SYS) returns the poles and zeros of the system in two
column vectors P and Z. No plot is drawn on the screen.
The functions SGRID or ZGRID can be used to plot lines of constant damping
ratio and natural frequency in the s or z plane.
9
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 03
AIM: - To write a MATLAB program for different find pole zero and draw pole zero graph for the
given function?.
PROCEDURE:-
Open MATLAB
Open new M-file
Type the program
Save in current directory
Compile and Run the program
For the output see command window\ Figure window
PROGRAM:-
clc
clear all
n=input('Enter the coefficient of numerator as^2 + bs + c like [a b c] = ');
d=input('Enter the coefficient of numerator as^2 + bs + c like [a b c] = ');
display(' Transfer Function will be : ')
sys=tf(n,d)
sgrid
[p z] = pzmap(sys)
pzmap(sys)
OUTPUT
Enter the coefficient of numerator as^2 + bs + c like [a b c] = [ 2 4 6 8]
Enter the coefficient of numerator as^2 + bs + c like [a b c] = [ 1 2 3]
Transfer Function will be :
Transfer function:
2 s^3 + 4 s^2 + 6 s + 8
-----------------------
s^2 + 2 s + 3
p=
-1.0000 + 1.4142i
-1.0000 - 1.4142i
z=
-1.6506
-0.1747 + 1.5469i
-0.1747 - 1.5469i
10
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
>>
11
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 04
SYS = SERIES(SYS1,SYS2,'name') connects SYS1 and SYS2 by matching I/O names. The
output names of SYS1 and input names of SYS2 should be fully specified.
If SYS1 and SYS2 are arrays of LTI models, SERIES returns an LTI array SYS of the same size
where SYS(:,:,k) = SERIES(SYS1(:,:,k),SYS2(:,:,k),OUTPUTS1,INPUTS2) .
12
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 04
AIM: - To write a MATLAB program for reduction of block diagram using block diagram reduction
techniques.
PROCEDURE:-
Open MATLAB
Open new M-file
Type the program
Save in current directory
Compile and Run the program
For the output see command window\ Figure window
PROGRAM:-
clc
clear all
n=input('Enter the coefficient of numerator as^2 + bs + c like [a b c] = ');
d=input('Enter the coefficient of denominator as^2 + bs + c like [a b c] =');
sys1=tf(n,d)
n1=input('Enter the coefficient of numerator as^2 + bs + c like [a b c] = ');
d1=input('Enter the coefficient of denominator as^2 + bs + c like [a b c]=');
sys2=tf(n1,d1)
n2=input('Enter the coefficient of numerator as^2 + bs + c like [a b c] =');
d2=input('Enter the coefficient of denominator as^2 + bs + c like [a b c]=');
sys3=tf(n2,d2)
n3=input('Enter the coefficient of numerator as^2 + bs + c like [a b c] =');
d3=input('Enter the coefficient of denominator as^2 + bs + c like [a b c]=');
sys4=tf(n3,d3)
display(' Transfer Function will be : ')
ans1=series(sys1,sys2);
ans2=parallel(ans1,sys3);
ans3=feedback(ans2, sys4,-1)
OUTPUT
Transfer function:
s+2
-------------
s^2 + 2 s + 3
13
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Transfer function:
1
-------------
s^2 + 2 s + 3
Transfer function:
1
-------------
s^2 + 2 s + 3
Transfer function:
1
-------------
s^2 + 2 s + 3
Transfer function:
s^6 + 7 s^5 + 27 s^4 + 62 s^3 + 95 s^2 + 87 s + 45
-------------------------------------------------------------------------
s^8 + 8 s^7 + 36 s^6 + 104 s^5 + 215 s^4 + 317 s^3 + 338 s^2 + 235 s + 96
>>
14
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 05
BODE(SYS) draws the Bode plot of the LTI model SYS (created with either TF, ZPK, SS, or
FRD). The frequency range and number of points are chosen automatically.
BODE(SYS,{WMIN,WMAX}) draws the Bode plot for frequencies between WMIN and
WMAX (in radians/second).
If SYS has NY outputs and NU inputs, MAG and PHASE are arrays of size [NY NU
LENGTH(W)] where MAG(:,:,k) and PHASE(:,:,k) determine the response at the frequency
W(k). To get the magnitudes in dB, type MAGDB = 20*log10(MAG).
For discrete-time models with sample time Ts, BODE uses the transformation Z =
exp(j*W*Ts) to map the unit circle to the real frequency axis. The frequency response is
only plotted for frequencies smaller than the Nyquist frequency pi/Ts, and the default value
1 (second) is assumed when Ts is unspecified.
15
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 05
AIM: - To write a MATLAB program for draw a bode plot and show effect of addition of poles and
Zeros?.
PROCEDURE:-
Open MATLAB
Open new M-file
Type the program
Save in current directory
Compile and Run the program
For the output see command window\ Figure window
PROGRAM:-
clc
clear all
n=input('Enter the coefficient of numerator as^2 + bs + c like [a b c] = ');
d=input('Enter the coefficient of denominator as^2 + bs + c like [a b c] = ');
display(' Transfer Function will be : ')
sys=tf(n,d)
b=1;
while b==1
a=input('Press 1. Bode plot \n 2. add pole \n 3. add zero \n 4. Exit \n Enter your choices') ;
switch a
case 1
display('Bode Plot will be: ')
bode(sys)
case 2
d1=input('Enter the coefficient of denominator as^2 + bs + c like [a b c] = ');
sys=tf(n,d1)
display('Bode Plot will be: ')
bode(sys)
case 3
n1=input('Enter the coefficient of numerator as^2 + bs + c like [a b c] = ');
sys=tf(n1,d)
display('Bode Plot will be: ')
bode(sys)
otherwise
break
end
b= input(' Do you want to continuous press 1 otherwise press 2 =');
end
16
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
OUTPUT
Transfer function:
1
-------------
s^2 + 2 s + 3
Transfer function:
1
-----------------------
2 s^3 + 4 s^2 + 6 s + 8
>>
18
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 06
NYQUIST(SYS) draws the Nyquist plot of the LTI model SYS (created with either TF, ZPK, SS,
or FRD). The frequency range and number of points are chosen automatically. See BODE
for details on the notion of frequency in discrete-time.
NYQUIST(SYS,{WMIN,WMAX}) draws the Nyquist plot for frequencies between WMIN and
WMAX (in radians/second).
[RE,IM] = NYQUIST(SYS,W) and [RE,IM,W] = NYQUIST(SYS) return the real parts RE and
imaginary parts IM of the frequency response (along with the frequency vector W if
unspecified). No plot is drawn on the screen. If SYS has NY outputs and NU inputs, RE and
IM are arrays of size [NY NU LENGTH(W)] and the response at the frequency W(k) is given
by RE(:,:,k)+j*IM(:,:,k).
19
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 06
AIM: - To write a MATLAB program for draw a Nyquist plot and show effect of addition of poles and
Zeros?.
PROCEDURE:-
Open MATLAB
Open new M-file
Type the program
Save in current directory
Compile and Run the program
For the output see command window\ Figure window
PROGRAM:-
clc
clear all
n=input('Enter the coefficient of numerator as^2 + bs + c like [a b c] = ');
d=input('Enter the coefficient of denominator as^2 + bs + c like [a b c]= ');
display(' Transfer Function will be : ')
sys=tf(n,d)
b=1;
while b==1
a=input('Press 1. Nyquist plot \n 2. add pole \n 3. add zero \n 4. Exit \n Enter your choices') ;
switch a
case 1
display('Nyquist Plot will be: ')
nyquist(sys)
case 2
d1=input('Enter the coefficient of denominator as^2 + bs + c like [a b c] = ');
sys=tf(n,d1)
display('Nyquist Plot will be: ')
nyquist(sys)
case 3
n1=input('Enter the coefficient of numerator as^2 + bs + c like [a b c] = ');
sys=tf(n1,d)
display('Nyquist Plot will be: ')
nyquist(sys)
otherwise
break
end
20
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
b= input (' Do you want to continuous press 1 otherwise press 2 =');
end
OUTPUT
Transfer function:
1
-----
s+2
Transfer function:
1
-------------
s^2 + 3 s + 2
22
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 07
RLOCUS(SYS) computes and plots the root locus of the single-input, single-output LTI
model SYS. The root locus plot is used to analyze the negative feedback loop and shows
the trajectories of the closed-loop poles when the feedback gain K varies from 0 to Inf.
RLOCUS automatically generates a set of positive gain values that produce a smooth plot.
RLOCUS(SYS1,SYS2,...) draws the root loci of multiple LTI models SYS1, SYS2,... on a
single plot. You can specify a color, line style, and marker for each model, as in
rlocus(sys1,'r',sys2,'y:',sys3,'gx').
23
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 07
AIM: - To write a MATLAB program for draw a Root Locus and show effect of addition of poles and
Zeros?.
PROCEDURE:-
Open MATLAB
Open new M-file
Type the program
Save in current directory
Compile and Run the program
For the output see command window\ Figure window
PROGRAM:-
clc
clear all
n=input('Enter the coefficient of numerator as^2 + bs + c like [a b c] = ');
d=input('Enter the coefficient of denominator as^2 + bs + c like [a b c = ');
display(' Transfer Function will be : ')
sys=tf(n,d)
b=1;
while b==1
a=input('Press 1. Root Locus \n 2. add pole \n 3. add zero \n 4. Exit \n Enter your choices') ;
switch a
case 1
display('Root Locus will be: ')
rlocus(sys)
case 2
d1=input('Enter the coefficient of denominator as^2 + bs + c like [a b c] = ');
sys=tf(n,d1)
display('Root Locus will be: ')
rlocus(sys)
case 3
n1=input('Enter the coefficient of numerator as^2 + bs + c like [a b c] = ');
sys=tf(n1,d)
display('Root Locus will be: ')
rlocus(sys)
otherwise
break
end
b= input(' Do you want to continuous press 1 otherwise press 2 =');
end
24
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
OUTPUT
Transfer function:
s+2
---------------------
s^3 + 2 s^2 + 3 s + 4
Transfer function:
s+2
-----------------------------
s^4 + 2 s^3 + 3 s^2 + 2 s + 1
>>
26
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 08
LTIVIEW opens an empty LTI Viewer. The LTI Viewer is an interactive graphical user
interface (GUI) for analyzing the time and frequency responses of linear systems and
comparing such systems. See LTIMODELS for details on how to model linear systems in the
Control System Toolbox.
LTIVIEW(SYS1,SYS2,...,SYSN) opens an LTI Viewer containing the step response of the LTI
models SYS1,SYS2,...,SYSN. You can specify a distinctive color, line style, and marker for
each system, as in
sys1 = rss(3,2,2);
sys2 = rss(4,2,2);
ltiview(sys1,'r-*',sys2,'m--');
27
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 08
AIM: - To write a MATLAB program to find time response (Step Response and Impulse Response)
of the system using LTIVIEW Command?
PROCEDURE:-
Open MATLAB
Open new M-file
Type the program
Save in current directory
Compile and Run the program
For the output see command window\ Figure window
PROGRAM:-
clc
clear all
x=1;
e=input('Enter the value of damping= ' );
w=input('Enter the value of wn undamped Frequency= ');
k=input('Enter the gain of the system= ');
n=[w*w*k];
d=[1 2*e*w w*w];
a=tf(n,d)
while (x==1)
b=input(' Press 1. Step Response \n 2. Impulse Response \n 3. Bode Plot \n 4. Nyquist plot \n 5.
Pole Zero \n 6. Exit \n Enter your Choice’);
switch b
case 1
display('Step Response will be ')
ltiview ('step',a);
case 2
display('Impulse Response will be ')
ltiview ('impulse’, a);
case 3
display('Bode Plot will be ')
ltiview ('bode’, a);
case 4
display('Nyquist plot will be ')
ltiview ('nyquist',a);
case 5
display('Pole Zero graph will be ')
ltiview ('pzmap',a);
otherwise
break;
x= input(' Do you Want to Continuous Press 1 otherwise 2');
end
28
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
end
OUTPUT
Transfer function:
100
----------------
s^2 + 12 s + 100
29
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
2. Impulse Response
3. Bode Plot
4. Nyquist plot
5. Pole Zero
6. Exit
Enter your Choice6
30
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 09
F = ILAPLACE(L) is the inverse Laplace transform of the scalar sym L with default
independent variable s. The default return is a function of t. If L = L(t), then
ILAPLACE returns a function of x:
F = F(x).
By definition, F(t) = int(L(s)*exp(s*t),s,c-i*inf,c+i*inf) where c is a real number
selected so that all singularities of L(s) are to the left of the line s = c, i = sqrt(-1), and
the integration is taken with respect to s.
31
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 09
AIM: - To write a MATLAB program to find State transition response , Zero input Response and
Zero State Response in State Space Analysis.
PROCEDURE:-
Open MATLAB
Open new M-file
Type the program
Save in current directory
Compile and Run the program
For the output see command window\ Figure window
PROGRAM:-
clc
clear all;
x=1
display(' Welcome to the world of state space analysis');
a= input(' Enter the Matrix A in Square Form Like 2*2 or 3*3 = ');
b= input(' Enter the Matrix B in n*1 where n will be Size of Matrix A = ');
c=input(' Enter the Matrix C in 1*n where n will be size of Matriz A = ');
d=[0];
x= input('Enter the Initial Value of X(0) in 1* n where n will be size of Matriz A = ');
sys=ss(a,b,c,d);
i=[1 0; 0 1];
syms s;
lti=(((s*i)-(a))^-1);
ans=[ilaplace(lti(1,1)) ilaplace(lti(1,2));ilaplace(lti(2,1)) ilaplace(lti(2,2))];
while (x==1)
b=input(' Press 1. State Transition Matrix \n 2. Zero Input Response \n 3. Zero State Response \n 4.
Total Response \n 5. Exit \n Enter your Choice' );
switch b
case 1
display(' State Transition Matrix will be :');
ans
case 2
display(' Zero Input Response will be :');
ans1=ans*x
case 3
display(' Zero State Response will be :');
w=lti*b*(1/s);
ans2=[ilaplace(w(1,1));ilaplace(w(2,1))]
case 4
w=lti*b*(1/s);
ans2=[ilaplace(w(1,1));ilaplace(w(2,1))];
32
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
ans1=ans*x;
display(' Total Response will be :');
ans3=ans1+ans2
otherwise
break;
end
end
OUTPUT
ans =
[ exp(t)*cosh(t*2^(1/2)), 2^(1/2)*exp(t)*sinh(t*2^(1/2))]
[ 1/2*2^(1/2)*exp(t)*sinh(t*2^(1/2)), exp(t)*cosh(t*2^(1/2))]
ans1 =
exp(t)*cosh(t*2^(1/2))+2^(1/2)*exp(t)*sinh(t*2^(1/2))
1/2*2^(1/2)*exp(t)*sinh(t*2^(1/2))+exp(t)*cosh(t*2^(1/2))
33
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
5. Exit
Enter your Choice3
Zero State Response will be :
ans2 =
3+3*exp(t)*(-cosh(t*2^(1/2))+2^(1/2)*sinh(t*2^(1/2)))
-3+3/2*(2*cosh(t*2^(1/2))-2^(1/2)*sinh(t*2^(1/2)))*exp(t)
ans3 =
exp(t)*cosh(t*2^(1/2))+2^(1/2)*exp(t)*sinh(t*2^(1/2))+4+4*exp(t)*(-cosh(t*2^(1/2))
+2^(1/2)*sinh(t*2^(1/2)))
1/2*2^(1/2)*exp(t)*sinh(t*2^(1/2))+exp(t)*cosh(t*2^(1/2))-4+2*(2*cosh(t*2^(1/2))-
2^(1/2)*sinh(t*2^(1/2)))*exp(t)
34
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 10
EXP Exponential.
EXP(X) is the exponential of the elements of X, e to the X.
For complex Z=X+i*Y, EXP(Z) = EXP(X)*(COS(Y)+i*SIN(Y)).
PI 3.1415926535897....
PI = 4*atan(1) = imag(log(-1)) = 3.1415926535897....
BREAK is not defined outside of a FOR or WHILE loop. Use RETURN in this context
instead.
35
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Experiment No: - 10
AIM: - To write a MATLAB program to find Rise time, peak time , Settle time and Maximum Peak
overshoot for Second order Control System.
PROCEDURE:-
Open MATLAB
Open new M-file
Type the program
Save in current directory
Compile and Run the program
For the output see command window\ Figure window
PROGRAM:-
clc
Clear all;
x=1;
e=input('Enter the value of damping= ' );
w=input('Enter the value of wn undamped Frequency= ');
k=input('Enter the gain of the system= ');
n=[w*w*k];
d=[1 2*e*w w*w];
a=tf(n,d)
e1 = e*e;
e2= 1-e1;
wd=w*(sqrt(e2));
q= atan(sqrt(e2)/e);
while (x==1)
b=input(' Press 1. Rise Time \n 2. Peak Time \n 3. Settle Time \n 4. Maximum
Peak Overshoot \n 5.Exit \n Enter your Choice' );
switch b
case 1
display('Rise Time will be ')
ans= ((pi-q)/wd)
case 2
display('Peak time will be ')
ans= pi/wd
case 3
display('Settle time will be ')
ans = 4 / (e*w)
case 4
display('Maximum Peak Overshoot will be ')
ans = exp((-e*pi)/(sqrt(e2)))*100
otherwise
break;
end
end
36
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
OUTPUT
Transfer function:
16
----------------
s^2 + 4.8 s + 16
ans =
0.6920
ans =
0.9817
ans =
1.6667
37
Name of Student
Roll No.
INDORE INSTITUTE OF SCIENCE & TECHNOLOGY
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
ans =
9.4780
38
Name of Student
Roll No.