Professional Documents
Culture Documents
CONTROL ENGINEERING
LABORATORY MANUAL
Experiment 4
STUDENT NAME:
SECTION: BSME-4B
1.0 INTRODUCTION
The analysis of continuous- and discrete-time signals is very important and is a requirement in
the analysis of feedback control systems. This chapter will introduce you to different techniques
in generating and analyzing continuous- and discrete-time signals using MATLAB.
3
f ( t )=t +20 sin ( 3 t )
Listing 2.1 shows a script that produces a continuous-time plot of Eq. 2.1.
Listing 2.1
t = -5:.01:5;
f = t.^3+20*sin(3.*t);
plot(t,f)
Listing 2.2 shows a script that produces an amplitude modulated signal with the equation:
y=20 sin ( t ) sin ( t /20 )
t = 0:.01:40*pi;
y=20*sin(t).*sin(t./20);
plot(t,y)
Step Function
Listing 2.3
t = -5:0.01:10;
y1 = zeros(1,length(-5:0.01:0-0.01));
y2 = 10*ones(1,length(0:0.01:10));
y = [y1 y2];
plot(t,y,’+’)
f s ( t )= A t>0
{ }
0 t<0
where, A is the amplitude of the function. If the amplitude A is 1.0, then the function is
called a unit step function, which is sometimes denoted as u(t).
Ramp Function
Listing 2.4
t1=-5:0.01:0-0.01;
t2=0:0.01:10;
t=[t1 t2];
y1 = zeros(1,length(t1));
y2 = 2*ones(1,length(t2)).*t2;
y=[y1 y2];
plot(t,y,’+’)
Figure 2.4: A plot of the ramp function with a multiplicative factor of 2.0.
A ramp function is a function that increases in amplitude as time increases from zero to infinity.
It is mathematically defined as:
f s ( t )= At t>0
{ }
0 t<0
where, A is a multiplicative factor that dictates the steepness of the ramp. If A is 1.0, the ramp
function is called a unit ramp function.
x ( t )= A sin ( 2 π +φ )= A sin ( ωt +φ )
Listing 2.5
Listing 2.5 shows a script that produces an amplitude modulated signal with the equation:
x ( t )=5 sin ( t )
t=0:2*pi/100:4*pi;
y=5*sin(t);
plot(t,y)
Figure 2.5: An example of a sinusoid
4.0 EXERCISES
1) Generate a step function with an amplitude of 5.0. Plot the signal at the range of
−10≤t≤20 seconds with a resolution of 0.01 secs.
2) Make a delay shift to the step function generated in No. 1 by 2 secs. Plot the signal at
the range and resolution given in No. 1.
3) Generate a pulse train with a period of 5 secs. and a duty cycle of 50%. Plot the pulse
train at the range 0≤t≤20 with a resolution of 0.01 secs.
* A duty cycle is the fraction of one period in which a signal or system is active.
4) Plot the function x ( t )=2 cos ( 100 πt ) +1 . The range is 0≤t≤0 .1 with a resolution of
0.001 secs.
5) Generate a sequence of impulses with amplitude of 1.0 at the range 0≤t≤5 seconds with a
resolution of 0.01 secs. The interval between pulses is 1 sec. Use the pulstran command as
tripuls with a sample rate and repetition amplitude of 0.
5.0 Data and Results
6.0 Analysis and Conclusions
With the proper knowledge on using matlab and by following the procedure we can easily
get the outcome we want.
7.0 References