Escolar Documentos
Profissional Documentos
Cultura Documentos
This vector encompasses 1000 time samples each second, or a sampling rate of 1000 Hz. To
generate a vector n of time values for discrete-time signals, say, from n= 0 to n= 1000, we use
the command
n=0:1000;
In the second command, pi is a built-in MATLAB function that returns the floating-point
number closest to . The plot command is used to view square wave. The command plot
draws lines connecting the successive values of the signal and thus gives the appearance of a
continuous-time signal. Try to vary the values of rho to rho=20 and rho=90.
1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
0
0.1
0.2
0.3
0.4
0.5
0.6
Figure 1
Page 1 of 5
0.7
0.8
0.9
-8
-6
-4
-2
10
Figure 3
Consider, for example, the discrete-time square wave shown in Figure 3. This signal is
generated by the following commands:
A=1;
omega=pi/4;
n=-10:10;
x=A*square(omega*n);
stem(n,x)
Page 2 of 5
The growing exponential signal shown in Figure 5 was generated with these commands
B=1;
a=5;
t=0:0.001:1;
x=B*exp(a*t);
plot(t,x);
150
5
4.5
4
3.5
100
3
2.5
2
50
1.5
1
0.5
0
0
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Figure 4
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Figure 5
Figure 9 is the discrete-time cosine signal generated using the following commands:
Page 3 of 5
2
1.5
0.5
0
-0.5
-1
-1.5
-2
-10
Figure 8
-8
-6
-4
-2
Figure 9
Page 4 of 5
10
10
9
8
7
6
5
4
3
2
1
0
0
10
Figure 15
In MATLAB, ones(M,N) is an M-by-N matrix of ones, and zeros (M,N) is an M-by-N matrix
of zeros. We may use these two matrices to generate two commonly used signals:
Discrete-time impulse
Step function
A pair of step functions shifted in time relative to each other may be used to produce a
rectangular pulse.
Page 5 of 5