Professional Documents
Culture Documents
(Practical File)
BACHELORS OF TECHNOLOGY
(Electronics and Communication)
AIM: Introduction to MATLAB and to study the basic signals Ramp, Step,
Impulse, Sine, Cosine, Exponential
SOFTWARE USED: MATLAB 5.1.0
THEORY:
1. Unit impulse signal: A signal which has infinite magnitude at time equal to
zero only.
Impulse function is denoted by δ(t). and it is defined as
δ(t) = {1 t=0,
0 t≠0
2. Unit step signal: A signal with magnitude one for time greater than zero .
Unit step function is denoted by u(t). It is defined as
u(t) = { 1 t⩾0,
0 t<0
3. Unit Ramp signal: A signal whose magnitude increases same as time . It can
be obtained by integrating unit step.
Ramp signal is denoted by r(t), and it is defined as
r(t) = {t t⩾0,
0 t<0
4. Unit Parabolic signal: A signal whose magnitude increases with the square of
time . It can be
obtained by integrating unit ramp.
Parabolic signal can be defined as
x(t) = {t^2/2 t⩾0,
0 t<0
5. Exponential Signal: Exponential signal is in the form of
x(t) = e^αt
The shape of exponential can be defined by α.
PROGRAM:
clc;
close all;
clear all;
% unit impulse signal
t=-1:0.001:1;
impulse=[zeros(1,1000),ones(1,1),zeros(1,1000)];
subplot(2,3,1);
plot(t,impulse);
xlabel('time->');
ylabel('Amplitude->');
title('Unit impulse signal');
axis([-1 1 0 1.5]);
%Unit step signal
t=-5:0.01:5;
step=[zeros(1,500),ones(1,501)];
subplot(2,3,2);
plot(t,step);
xlabel('time->');
ylabel('Amplitude->');
title('Unit step signal');
axis([-5 5 0 1.5]);
%Unit ramp signal
t=0:0.01:6;
ramp=t;
subplot(2,3,3);
plot(t,ramp);
xlabel('time->');
ylabel('Amplitude->');
title('Unit ramp signal');
%Sine wave signal
t = [0:0.1:2*pi];
a = sin(t);
subplot(2,3,4);
plot(t,a);
xlabel('time->');
ylabel('Amplitude->');
title('Sine wave signal');
%Cosine wave signal
t = [0:0.1:2*pi];
a = cos(t);
subplot(2,3,5);
plot(t,a);
xlabel('time->');
ylabel('Amplitude->');
title('Cosine wave signal');
% exponential signal
t=-5:0.01:5;
exp=exp(-t);
subplot(2,3,6);
plot(t,exp);
xlabel('time->');
ylabel('Amplitude->');
title('Exponential signal');
OUTPUT:
AIM : To plot poles and zeros of a Transfer Function. G(S) = 2S^2 +S+5 /
(3S+1)(6s^2+2S+4
SOFTWARE USED: MATLAB 5.1.0
PROGRAM:
% To obtain poles and zeros plot of a Transfer Function
num = [2 1 5];
den = conv([3 1],[6 2 4]);
g = tf(num, den);
[p,z]=pzmap(g);
pzmap(g);
sgrid;
OUTPUT
OUTPUT:
This graph sheet includes various concentric circles and radial lines. The concentric
circles and the radial lines are considered as the magnitudes and phase angles.
These angles are highlighted with positive values in anti-clock wise direction. So
that, we can mark angles with negative values in clockwise direction. Let’s see this
example where the angle 270 0 in anti-clock wise direction is equal to the angle
−90 0 in clockwise direction.
Rules for Drawing Polar Plots
Below mentioned rules are used for plotting the polar plots.
Substitute, s= jω in the open loop transfer function.
Write the expressions for magnitude and the phase of G(jω)H(jω).
Find the starting magnitude and the phase of G(jω)H(jω) by substituting ω=0.
So, the polar plot starts with this magnitude and the phase angle.
Find the ending magnitude and the phase of G(jω)H(jω)by substituting ω=∞.
So, the polar plot ends with this magnitude and the phase angle.
Check whether the polar plot intersects the real axis, by making the
imaginary term of G(jω)H(jω) equal to zero and find the value(s) of ω.
Check whether the polar plot intersects the imaginary axis, by making real
term of G(jω)H(jω) equal to zero and find the value(s) of ω.
For drawing polar plot more clearly, find the magnitude and phase of
G(jω)H(jω) by considering the other value(s) of ω.
EXAMPLE:- Consider the transfer function 20/s^2 + 6s + 25 and draw the polar
plot.
CODE:-
w=[[0:.1:5], [6:1000]];
%G(s) = 20/s^2 + 6s + 25
num = [20];
den= [1 6 25];
G = freqs(num, den, w);
M = abs(G);
Ph = angle(G);
polar(Ph, M);
OUTPUT:-
num = 20
den = 1 6 25
PLOT:-
RESULT/OUTPUT:- Show the polar plot of the given system transfer function.
EXPERIMENT NO 6
AIM:- Determine and analyze the bode plot for the given system using suitable
software tools (e.g. MATLAB) and comment on system stability
SOFTWARE USED:- MATLAB
THEORY: The frequency response method may be less intuitive than other
methods you have studied previously. However, it has certain advantages,
especially in real-life situations such as modeling transfer functions from physical
data. The frequency response of a system can be viewed two different ways: via
the Bode plot or via the Nyquist diagram. Both methods display the same
information; the difference lies in the way the information is presented. We will
explore both methods during this lab exercise. The frequency response is a
representation of the systems response to sinusoidal inputs at varying frequencies.
The output of a linear system to a sinusoidal input is a sinusoid of the same
frequency but with a different magnitude and phase. The frequency response is
defined as the magnitude and phase differences between the input and output
sinusoids. In this lab, we will see how we can use the open-loop frequency
response of a system to predict its behavior in closed loop. To plot the frequency
response, we create a vector of frequencies (varying between zero or “DC” and
infinity i.e., a higher value) and compute the value of the plant transfer function at
those frequencies. If G(s) is the open loop transfer function of a system and ω is
the frequency vector, we then plot G( jω) vs. ω . Since G( jω) is a complex number,
we can plot both its magnitude and phase (the Bode plot) or its position in the
complex plane (the Nyquist plot).
The gain margin is defined as the change in open loop gain required to make the
system unstable. Systems with greater gain margins can withstand greater changes
in system parameters before becoming unstable in closed loop. The phase margin
is defined as the change in open loop phase shift required to make a closed loop
system unstable.
Example: Obtain Bode Plot of the system having forward path transfer function of
(2s + 5)/(3s^2 + 7s + 4)
CODE:
clc
num=[2 5];
den=conv([1 1], [3,4]);
w=logspace(-1,3,100);
figure(1);
bode(num,den,w);
title('Bode Plot for the given transfer function G(s)=(2s +
5)/(3s^2 + 7s + 4)')
grid;
[Gm Pm Wcg Wcp] =margin(num,den);
Gain_Margin_dB=20*log10(Gm)
Phase_Margin=Pm
Gaincrossover_Frequency=Wcp
Phasecrossover_Frequency=Wcg
[M P w]=bode(num,den);
[Mp i]=max(M);
Resonant_PeakdB=20*log10(Mp)
Wp=w(i);
Resonant_Frequency=Wp
for i=1:1:length(M);
if M(i)<=1/(sqrt(2));
Bandwidth=w(i)
break;
end;
end;
OUTPUT:
AIM: Determine and analyze the root locus plot for the given system transfer
function using suitable software tools (e.g. MATLAB) and comment on system
stability.
RESULT: Discuss the root locus plot of the given system transfer function.