0% found this document useful (0 votes)
61 views4 pages

Tugas 1

The document provides instructions and MATLAB programs for generating and analyzing various types of discrete-time signals including unit sample sequences, exponential sequences, sinusoidal sequences, random signals, and complex signals formed by combining basic signals. The questions ask the student to run the provided programs, modify some programs to generate different signals, analyze properties of the generated signals such as frequency and power, and compare the outputs of different programs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views4 pages

Tugas 1

The document provides instructions and MATLAB programs for generating and analyzing various types of discrete-time signals including unit sample sequences, exponential sequences, sinusoidal sequences, random signals, and complex signals formed by combining basic signals. The questions ask the student to run the provided programs, modify some programs to generate different signals, analyze properties of the generated signals such as frequency and power, and compare the outputs of different programs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Tugas 1.

Praktikum Pengolahan Sinyal Digital:

1. LABORATORY EXERCISE 1
DISCRETE-TIME SIGNALS: TIME-DOMAIN REPRESENTATION GENERATION OF
SEQUENCES

Project 1.1 Unit sample and unit step sequences

% Program P1_1
% Generation of a Unit Sample Sequence
clf;
% Generate a vector from -10 to 20
n = -10:20;
% Generate the unit sample sequence
u = [zeros(1,10) 1 zeros(1,20)];
% Plot the unit sample sequence
stem(n,u);
xlabel('Time index n');ylabel('Amplitude');
title('Unit Sample Sequence');
axis([-10 20 0 1.2]);

Q1.1 Run Program P1_1 to generate the unit sample sequence u[n] and display it.
Q1.2 What are the command clf ,axis, title, xlabel, and ylabel
Q1.3 Modify Program P1_1 to generate a delayed unit sample sequence ud[n] with a delay of 11
samples. Run the modified program and disply program the sequence generated.
Q1.4 Modify Program P1_1 to generate a unit step sequence s[n] . Run the modified program and
display the sequence generated.
Q1.5 The modified Program P1_1 to generate a unit step sequence sd[n] with an advance of 7
samples is given below along with the sequence generated by running this program.

Project 1.2 Exponential signals

% Program P1_2
% Generation of a complex exponential sequence
clf;
c = -(1/12)+(pi/6)*i;
K = 2;
n = 0:40;
x = K*exp(c*n);
subplot(2,1,1);
stem(n,real(x));
xlabel('Time index n');
ylabel('Amplitude');
title('Real part');
subplot(2,1,2);
stem(n,imag(x));
xlabel('Time index n');
ylabel('Amplitude');
title('Imaginary part');

% Program P1_3
% Generation of a real exponential sequence
clf;
n = 0:35; a = 1.2; K = 0.2;
x = K*a.^n;
stem(n,x);
xlabel('Time index n');
ylabel('Amplitude');

Q 1.6 Run Program P1_2 and generated The complex-valued exponential sequence.
Q 1.7 Which the parameter controls the rate of growth or decay of this sequence? Which The
parameter controls the amplitude of this sequence ?
Q 1.8 What will happen if the parameter c changing to (1/12) + (π/6) * ?
Q 1.9 What are the purposes of the operator real and imag?
Q 1.10 What is the purpose of the command subplot?
Q 1.11 Run Program P1_2 and generated The real-valued exponential sequence
Q 1.12 Which the parameter controls the rate of growth or decay of this ? Which the parameter
controls the amplitude of this sequence?
Q 1.13 What is the difference between the arithmetic operators ^ and .^
Q 1.14 What will happen if the parameter a less than 1? Run Program P1_3 again with the parameter
a changed to 0.9 and the parameter K changed to 20?
Q 1.15 What is the length of this sequence and how can it be changed?
Q 1.16 You can use the MATLAB command sum(s.*s) to compute the energy of a real sequence s[n]
stored as avector s. Evaluated the energy of a real sequences x[n] generated in Q1.11 and
Q1.14

Project 1.3 Sinusoidal Sequences

% Program P1_4
% Generation of a sinusoidal sequence
n = 0:40;
f = 0.1;
phase = 0;
A = 1.5;
arg = 2*pi*f*n - phase;
x = A*cos(arg);
clf;
% Clear old graph
stem(n,x);
% Plot the generated sequence
axis([0 40 -2 2]);
grid;
title('Sinusoidal Sequence');
xlabel('Time index n');
ylabel('Amplitude');
axis;

Q1.17 Run Program P1_4 to generate The sinusoidal sequence generated and display it.
Q1.18 What is The frequency of this sequence and how can it be changed? Which parameter controls
the phase of this sequence? Which parameter controls the amplitude of this sequence? What is
the period of this sequence?
Q1.19 What is The length of this sequence and how can it be changed?
Q1.20 Compute The average power of the generated sinusoidal sequence
Q1.21 What are The purpose of axis and grid command?

Q1.22 The modify Program P1_4 to generate a sinusoidal sequence of frequency 0.9 and display it.
Compare this new sequence with the one generated in questin Q1.17. Now modify Program
P1_4 to generate a sinusoidal sequence of frequency 1.1 and display it. Compare this new
sequence with the one generated in question Q1.17. Comment on your result.
Q1.23 Modify the above program to generate The sinusoidal sequence of length 50, frequency 0.08,
amplitude 2.5, and phase shift of 90 degrees and display it. What is the period of this
sequence?
Q1.24 Replace the stem command in Program P1_4 with the plot command and run the program
again. What the difference between the new plot and the one generated in question Q1.17?
Q1.25 Replace the stem command in Program P1_4 with the stairs command and run the program
again. What the difference between the new plot and those generated in question Q1.17 and
Q1.24?

Project 1.4 Random signal

A random signal of length N with samples uiniformly distributed in the interval (0,1) can be
generated by using the MATLAB command

X=rand(1,N);

Likewise, a random signal x[n] of length N with samples normally distributed with zero mean and
unity variance can be generated by using the following MATLAB command

X=randn(1,N);

Q1.26 Write The MATLAB program to generate and display a random signal of length 100 with
elements uniformly distributed in the interval [–2, 2]

Q1.27 Write The MATLAB program to generate and display a Gaussian random signal of length 75
with elements normally distributed with zero mean and a variance of 3
Q1.28 Write The MATLAB program to generate and display five sample sequences of a random
sinusoidal signal of length 31
{X[n]} = {A . cos (πon + )}
where the amplitude A and the phase  are statistically independent random variables with
uniform probability distribution in the range 0<=A<=4for the amplitude and in the range 0 
   for the phase

2. LABORATORY EXERCISE 2
DISCRETE-TIME SIGNALS: SIMPLE OPERATION ON SEQUENCES

Project 1.5 Signal Smoothing

A common example of a digital signal proceccing application is the removal of the noise component
from a signal corrupted by additive noise. Let s[n] be signal corrupted by a random noise d[n]
resulting in the noisy signal x[n]=s[n]+d[n]. The objective is to operate on x[n] to generate a signal
y[n] which is reasonable approximation to s[n]. To this end, a simple approach is to generate an
output sample by averaging a number of input samples around the sample at instan n. For example, a
three-ponit moving average algorithm is given by

Y[n]=(1/3)(x[n-1]+x[n]+x[n+1])

% Program P1_5
% Signal Smoothing by Averaging
clf;
R = 51;
d = 0.8*(rand(R,1) - 0.5); % Generate random noise
m = 0:R-1;
s = 2*m.*(0.9.^m); % Generate uncorrupted signal
x = s + d'; % Generate noise corrupted signal
subplot(2,1,1);
plot(m,d','r-',m,s,'g--',m,x,'b-.');
xlabel('Time index n');ylabel('Amplitude');
legend('d[n] ','s[n] ','x[n] ');
x1 = [0 0 x];x2 = [0 x 0];x3 = [x 0 0];
y = (x1 + x2 + x3)/3;
subplot(2,1,2);
plot(m,y(2:R+1),'r-',m,s,'g--');
legend( 'y[n] ','s[n] ');
xlabel('Time index n');ylabel('Amplitude');

Q1.29 Run Program P1_5 and generate all pertinent signals


Q1.30 What is the form of the uncorrupted signal s[n]/ What is the form of the additive noise d[n]?
Q1.31 Can you use the statement x=s+d to generate the noise-corrupted signal? If not, why not?
Q1.32 What are the relations between the signals x1, x2, and x3, and the signal x?
Q1.33 What is the purpose of the legend command?

Project 1.6 Generation of Complex Signals

More complex signals can be generated by performing the basic opertations on simple signals. For
example, an amplitude modulated signals can be generated by modulating a hight-frequency
sinusoidal signal xH[n]=cos(ωHn) with a low-frequency modulating signal xL[n]=cos(ωLn). The
Resulting signal y[n] is of the form

Y[n]=A(1+m.xL[n])xH[n]=A(1+m.cos(ωLn)) cos(ωHn),

Where m, called the modulation index, is a number chosen to ensure that (1+m.xL[n]) is positive for
alln. Program P1_6 can be used to generate an amplitude modulated signal.

% Program P1_6
% Generation of amplitude modulated sequence
clf;
n = 0:100;
m = 0.4;fH = 0.1; fL = 0.01;
xH = sin(2*pi*fH*n);
xL = sin(2*pi*fL*n);
y = (1+m*xL).*xH;
stem(n,y);grid;
xlabel('Time index n');ylabel('Amplitude');

Q1.34 Run Program P1_6 and generate hhe amplitude modulated signals y[n] for various values
of the frequencies of the carrier signal xH[n] and the modulating signal xL[n], and various
values of the modulation index m.
Q1.35 What is the difference between the arithmetic operators * and .*

As the frequency of a sinusoidal signal is the derivative of its phase with respect to time, to generate a
swept-frequency sinusoidal signal whose frequency increases linearly with time, the argument of the
sinusoidal signal must be a quadratic function of time. Assume that the argument is of the form an2 +
bn (i.e. the angular frequency is 2an + b). Solve for the values of a and b form the given conditions
(minimum angular frequency and maximum angular frequency). Program P1.7 is an example
program to generate this kind of signal.

% Program P1_7
% Generation of a swept frequency sinusoidal sequence
n = 0:100;
a = pi/2/100;
b = 0;
arg = a*n.*n + b*n;
x = cos(arg);
clf;
stem(n, x);
axis([0,100,-1.5,1.5]);
title('Swept-Frequency Sinusoidal Signal');
xlabel('Time index n');
ylabel('Amplitude');
grid; axis;

Q1.36 Run program P1_7 anda generate the swept-frequency sinusoidal sequence x[n]
Q1.37 The minimum and maximum frequencies of this signal
Q1.38 How can you modify the Program 1_7 to generate a swept sinusoidal signal with a
minimum frequency of 0.1 and a maximum frequency of 0.3

You might also like