Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
EXPERIMENT : 01
NO
DATE OF : 11 – 09 - 2017
EXPERIMENT
REG NO : 150101009
BATCH : AERO 14-A
CONTENTS
________________________________________________________________________
Experiment # 01 CONTROL SYSTEMS Page 1 of 12
_________________________________________________________________________
1. Purpose ........................................................................................................................ 3
2. Definition and Introduction ......................................................................................... 3
3. Basic Arithmetic Functions ......................................................................................... 4
4. Plotting and Furnishing Output Response ................................................................... 6
________________________________________________________________________
Experiment # 01 CONTROL SYSTEMS Page 2 of 12
_________________________________________________________________________
1. Purpose
Purpose of this experiment is to provide basic introduction to students. In this experiment,
there are explained some basic MATLAB programming syntax that plays important role
to pick basic concepts of control system.
Meaning of matlab
Matlab stands for matrix laboratory. As the name suggests, Matlab is especially designed
for matrix computations and solving systems of linear equations, scalar (single element), a
vector (one dimensional) or an nxm matrix (two dimensional) and multidimensional
matrix.
Matrix Laboratory
Matlab or Matrix Laboratory is a high-level language and interactive or environment that
enables you to perform computationally intensive tasks faster than with traditional
Programming languages such as C and FORTRAN. It integrates computation,
visualization, and programming in an easy to use environment where problems and
solutions are expressed in familiar mathematical notation to capture ideas that are created.
Main Uses
• High-level language for technical computing
• Development environment for managing code, files, and data
• Interactive tools for iterative exploration, design, and problem solving
• Mathematical functions for linear algebra, statistics, Fourier analysis, Filtering,
optimization, and numerical integration
• 2-D and 3-D graphics functions for visualizing data
• Tools for building custom graphical user interfaces
• Functions for integrating Matlab based algorithms with external Applications and
languages, such as C, C++, FORTRAN, Java, COM
________________________________________________________________________
Experiment # 01 CONTROL SYSTEMS Page 3 of 12
_________________________________________________________________________
Arithmetic Operation
These operations are consisting on basic math formulas and by these, there can be verify
basic properties of relation such as associate property, communicative property.
Colon Operation
This command can perform the step given in between two values.
Initial Value : Step Size : Final Value
>> 2:2:10
ans =2 4 6 8 10
>> 1:4
ans =1 2 3 4
If you did not want to include the initial value, then use the following formula as
Initial Value + Step Size : Step Size : Final Value
Power Factor
>> B=A.^2
B = 4 16 36 64 100
Arrays
________________________________________________________________________
Experiment # 01 CONTROL SYSTEMS Page 4 of 12
_________________________________________________________________________
Arrays has its second name as Row vector in mathematic. It can be in Geometric form
random form. There are many logics to develop array that depend upon programmer such
as ‘FOR LOOP’ logic etc.
Geometric Array:
>> n=1:4
n =1 2 3 4
>> 3.^n
ans =3 9 27 81
Random Array:
>> x=[1 -1 5 10 11]
x = 1 -1 5 10 11
>> 2.^(1:2:7)
ans = 2 8 32 128
Basic operations that relates with matrices are transpose, inverse and determinant eigen
value etc. A matrix has mxn dimension.
>> A=[1 2 3; 4 5 6; 7 8 9]
A=
1 2 3
4 5 6
7 8 9
Determinant:
For determinant, ‘det(matrix variable)’ syntax is used such as
>> det(A)
ans = -9.5162e-16
Transpose:
You have also idea about transpose of matrix. In MATLAB, there are two syntax to
represents a matrix in transpose such as given below
________________________________________________________________________
Experiment # 01 CONTROL SYSTEMS Page 5 of 12
_________________________________________________________________________
>> b=A'
b=
1 4 7
2 5 8
3 6 9
>> transpose(A)
ans =
1 4 7
2 5 8
3 6 9
Inverse:
Inverse of any matrix through MATLAB can be calculated as
>> inv(A)
ans =1.0e+16 *
Plotting
Plotting is a procedure that show response of specific function or variable in picture form.
It has different form to exhibit response such as stairs, discrete and continues. There is
appear only one window for one response. If you want to check more than one response in
one window, then MATLAB provide facility to deal with this situation. There are some
syntax of plotting types as
For plotting more than one response in same window, there is given syntax as
‘subplot(m,n,p) or subplot(mnp)’
________________________________________________________________________
Experiment # 01 CONTROL SYSTEMS Page 6 of 12
_________________________________________________________________________
Where m and n represents number of rows and columns while p indicate number of entries
about responses.
subplot(3,1,1);
plot(n,x)
subplot(3,1,2);
stem(n,x)
subplot(3,1,3);
stairs(n,x)
Furnishing
In this topic, there will be explained briefly about title axis titles that provide detail about
output response. Grid and labeling of title and x,y axis, have syntax that are given below
as
title(‘Output name’) it is used to give desired title to output response.
xlabel(‘name’) and ylabel(‘name’) this syntax is used to give name axis.
grid on/off it is used to scale output responded figure.
________________________________________________________________________
Experiment # 01 CONTROL SYSTEMS Page 7 of 12
_________________________________________________________________________
h=exp(-1*a*t);
subplot(1,2,2)
plot(h)
grid on
title('Decreasing
Exponential Function')
xlabel('Time')
ylabel('Amplitude')
Legend is used to display more than one responses to show difference between them. this
command automatically colored the responses. While MATLAB gives option to adjust his
own desired value of axis.
________________________________________________________________________
Experiment # 01 CONTROL SYSTEMS Page 8 of 12
_________________________________________________________________________
n=-5:5;
rmp=[zeros(1,5) 2
zeros(1,5)];
plot(n,rmp);
hold on
legend('Impulse
Response','Ramp
Response');
grid on
axis([-10 10 0 5]);
xlabel('time');
ylabel('amplitude');
Task
0.45 0 9 0.9 11 60
𝑨=[ 0 −2 6 ] 𝑩=[ 5 −0.99 30]
0 4 0.03 78 − 88 0.89 90
Q#3 Plot unit step signal and that overlap impulse function at same amplitude.
________________________________________________________________________
Experiment # 01 CONTROL SYSTEMS Page 9 of 12
_________________________________________________________________________
Ans 1:
A = [0.45 0 9; 0 -2 6; 0 4 0.03];
B = [0.9 11 60; 5 -0.99 30; 78-88 0.89 90];
Ans 1 (a):
if A + B == B + A
disp('Commutative Property For Addition Satisfies')
else
disp('Commutative Property For Addition Not Satisfies')
end
if A * B == B * A
disp('Commutative Property For Multiplication Satisfies')
else
disp('Commutative Property For Multiplication Not Satisfies')
end
Ans 1 (b):
if isequal(num2str(inv(A*B),'%12.5f'),num2str(inv(B)*inv(A),'%12.5f'))
disp ('Property For Inverse Satisfied ')
else
disp ('Property For Inverse Not Satisfied')
end
Ans 1 (c):
if isequal(num2str(transpose(B),'%12.5f'),num2str(B,'%12.5f'))
disp ('B is Symmetric ')
else
disp ('B is not Symmetric')
end
if isequal(num2str(-B,'%12.5f'),num2str(B','%12.5f'))
disp ('B is Skew Hermatian ')
else
disp ('B is not Skew Hermatian')
end
Ans 1 (d):
X = A\B;
disp(X)
Ans 2:
t = 0:0.1:20;
y = sin(t);
subplot(4,2,1)
________________________________________________________________________
Experiment # 01 CONTROL SYSTEMS Page 10 of 12
_________________________________________________________________________
plot(t,y);
grid on
title('Sine Function')
xlabel('Time')
ylabel('Amplitude')
syms t
subplot(4,2,2)
ezplot(csc(t),[0,20]);
grid on
title('Cosecant Function')
xlabel('Time')
ylabel('Amplitude')
t = 0:0.1:20;
y = cos(t);
subplot(4,2,3)
plot(t,y);
grid on
title('Cosine Function')
xlabel('Time')
ylabel('Amplitude')
syms t
subplot(4,2,4)
ezplot(sec(t),[0, 20]);
grid on
title('Secant Function')
xlabel('Time')
ylabel('Amplitude')
subplot(4,2,5)
ezplot(tan(t),[0,20]);
grid on
title('Tangent Function')
xlabel('Time')
ylabel('Amplitude')
subplot(4,2,6)
ezplot(cot(t),[0,20]);
grid on
title('Cotangent Function')
xlabel('Time')
ylabel('Amplitude')
Ans 3:
subplot(4,2,7)
m = -1:1;
imp = [0 1 0];
stem (m , imp);
hold on
m = -10:10;
step = [zeros(1,10) , ones(1,11)];
stairs(m, step);
grid on
title ('Overlap')
xlabel ('Time')
ylabel('Amplitude')
________________________________________________________________________
Experiment # 01 CONTROL SYSTEMS Page 11 of 12
_________________________________________________________________________
________________________________________________________________________
Experiment # 01 CONTROL SYSTEMS Page 12 of 12