0% found this document useful (0 votes)
24 views10 pages

Untitled 2

Uploaded by

Tanvir Alam
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)
24 views10 pages

Untitled 2

Uploaded by

Tanvir Alam
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/ 10

Experiment No: 2A

Experiment Name: Continuous time and Discrete time representation of signals.

Objectives

• To represent (plot) basic signals (sine, cosine, sine, unit impulse, unit step, unit ramp, exponential
signal) in MATLAB.
• To generate noise signal in MATLAB.

Programming, Analysis and Result:

Practice problem-1: Using subplot option divide a plot into four subplots (2X2). Show the signals in
subplot as stated below Programming

Subplot-1:

subplot(2,2,1)
F47=11; %(M+N)=4+7=11
Fs47=48; %(M*5+N*3+L)=(4*5+7*3+7)=48
T47=1/Fs47;
duration47=5.5;%(M/2+N/4)=(4/2+7/4)=5.5
t47=0:T47:duration47;
A47=2.2;%(7+4+7)/5=2.2
y=A47*sin(2*pi*F47*t47);
plot(t47,y)
title('A Continuous Plot of Sine Wave by ET73047');
xlabel('Time')
ylabel('Amplitude')

1
Subplot

F1=14; % (L+N)=(7+7)=14
F2=11; %(L+M)=(7+4)=11
duration47=2.75;%(M+N)/4)=(4+7)/4=2.75
Fs47=43; %(7*3+7*2+4*2)=43
T47=1/Fs47;
t47=0:T47:duration47;
n=t47/T47

n = 1×119
0 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000

y=sin(2*pi*F1*t47)+sin(2*pi*F2*t47);
stem(n,y)
title('A Discrete Plot by ET173047')
xlabel('Sample')
ylabel('Amplitude')

Subplot-3

subplot(2,2,3)
F47=4; % (A+B+C)=(1+3+0)=4
Fs47=49; %(L*3+N*4)=(7*3+7*4)=49
T47=1/Fs47;

2
duration47=2.75;%((M+N)/4)=(4+7)/4=2.75
A47=2.2; %(7+4+7)/5=2.2
t47=0:T47:duration47;
n=t47/T47

n = 1×135
0 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000

y = A47*cos(2*pi*F47*t47)

y = 1×135
2.2000 1.9169 1.1405 0.0705 -1.0176 -1.8438 -2.1955 -1.9821

scatter(n,y)
title('A Discrete Plot of Cos Wave by ET173047')
xlabel('sample')
ylabel('Amplitude')

Subplot-4

subplot(2,2,4)
F47=2; % (A+B+C)=(1+3+0)=4
Fs47=49; %(L*3+N*4)=(7*3+7*4)=49
T47=1/Fs47;
t47=-11:T47:11; %duration –(M+N)=-(4+7)=-11 to (M+N)=(4+7)=11
n=t47/T47

n = 1×1079
-539.0000 -538.0000 -537.0000 -536.0000 -535.0000 -534.0000 -533.0000 -532.0000

A47=4; %(7+4+7)/5=2.2
y=A47*sinc(2*pi*F47*t47)

y = 1×1079
0.0061 -0.0008 -0.0072 -0.0092 -0.0056 0.0015 0.0077 0.0091

stem(n,y)
title('A Discrete Plot of Sinc Function by ET173047')
xlabel('sample')
ylabel('Amplitude')

3
Analysis: For Subplot:1 Amplitude=2, Frequency=11Hz, Sampling Rate Fs=48Hz, so the Time interval
T=1/48, and our duration is o to 5.5s. For time vector I declare t47=0:T47:duration47 and for y vector
y=A47*sin(2*pi*F47*t47). Here in the question, it asked to plot a continuous plot of sine wave. That’s why
I use the “plot” command where Time t47 is our x axis value and y is our Amplitude or y axis value. Which
finally provides a sinusoidal continuous plot.

For Subplot:2

F1=14Hz, F2=11Hz, Duration46= 0 to 5.5s, sampling rate Fs=48. So, the Time interval T47=1/48. Now time
vector t=0:T47:duration47. In the question it asked to show the amplitude with respect to sample position. So,
sample position n=t47/T47. As we can see we need to plot a discrete plot. That’s why I use “stem” command
to plot this where Sample position is our x axis value and y is our Amplitude or y axis value. Which finally
provides a discrete plot.

For Subplot:3

Amplitude=2, Frequency=4Hz, Sampling Rate Fs47=49Hz, so the Time interval T=1/47, and our duration
is o to 5.5s. For time vector t47=0:T47:duration47 and for y vector y=A*cos(2*pi*F47*t47). In the question it
is asked to show the amplitude with respect to sample position. So, Sample Position n=t47/T47. Here in the
question, it asks to plot a scatter plot of Cosine wave. That’s why I use “scatter” command where n is our x
axis value and y is our amplitude which finally provides a discrete plot of Cosine wave.

For Subplot:4

Amplitude A=2, Frequency F47=4Hz, Sampling rate Fs47=49Hz, so time interval T=1/47, and our duration is
-11 to 11s. For time vector I declare t47= -11:T47:11 and for y vector y=A*sinc(2*pi*F47*t47). In the question
it is asked to show the amplitude with respect to sample position. So, sample position n=t47/T47. As we can

4
see we need to plot a discrete plot. That’s why I use “stem” command to plot this where n is our x axis value
and y is our amplitude which finally provides a discrete plot of sinc function.

Practice problem-2: Using subplot option divide a plot into three subplots (3X1). Show the signals in subplot
as stated below

Programming:

Subplot-1

subplot(3,1,1)
a47=-11; %-(L+M)=-(7+4)=-11
b47=14; %(L+N)=(7+7)=14
n=a47:b47;
y47=[zeros(1,abs(a47)),ones(1,1),zeros(1,b47)];
stem(n,y47);
title('Unit Sample Sequence of ET173047');
xlabel('Sample position');
ylabel('Amplitude');

Subplot-2

subplot(3,1,2)
a47=-11; %-(L+M)=-(7+4)=-11
b47=14; %(L+N)=(7+7)=14
n=a47:b47;

5
y47=[zeros(1,abs(a47)),ones(1,1),ones(1,b47)];
stem(n,y47);
title('Unit step Sequence of ET173047');
xlabel('Sample position');
ylabel('Amplitude');

Subplot-3

subplot(3,1,3)
n=0:11; %(L+M+N)=(7+4+7)=11
y47=n;
stem(n,y47);
title('Unit Ramp Sequence of ET173047');
xlabel('Sample Position');
ylabel('Amplitude');

Analysis:

For Subplot:1 Here for Unit Impulse signal my sample position ‘n’ is -11 to 14. So, I use zeros and ones
function to show the amplitude of this signal. As from question to make discrete plot I use “stem” command
where Sample position n is our x axis value and y is our Amplitude or y axis value.

For Subplot:2

6
Here for Unit Step signal my sample position ‘n’ is -11 to 14. So, I use zeros and ones function to show the
amplitude of this signal. I use “stem” command to show discrete output of this signal where Sample position n
is our x axis value and y is our Amplitude or y axis value.

For Subplot:3

Here for Unit Ramp Sequence, my sample position ‘n’ is 0 to 11. This signal amplitude will rise with its
sample position. For this reason I use “y=n”. Which mean its current amplitude will be its current sample
position. I use “stem” command to show discrete output of this signal.

Practice Problem-3: Using subplot option divide a plot into four subplots (2X2). Show the signals in subplot
as stated below

Programming:

Subplot-1:

subplot(2,2,1)
a47=0.916; %a=(M+N)/(M+N+1)=(4+7)/(4+7+1)=11/12=0.9166
n=0:200; %(L+M+N)*10=(7+4+7)*10=18*10=180
y=a47.^n;
stem(n,y);
title('Subplot 2 of ET173047');
xlabel('Sample Position');
ylabel('Amplitude');

Subplot-2:

subplot(2,2,2)
a47=1.09; %a=(M+N+1)/(M+N)=(4+7+1)/(4+7)=12/11=1.09
n=0:180; %(L+M+N)*10=(7+4+7)*10=18*10=180
y=a47.^n;
stem(n,y);
title('Subplot 2 of ET173047');
xlabel('Sample Position');
ylabel('Amplitude');

7
Subplot-3:

subplot(2,2,3)
a47=0.916; %a=-(M+N)/(M+N+5)=-(4+7)/(4+7+5)=-11/16=-0.6875
n=0:180; %(L+M+N)*10=(7+4+7)*10=18*10=180
y=a47.^n;
stem(n,y);
title('Subplot 2 of ET173047');
xlabel('Sample Position');
ylabel('Amplitude');

Subplot-4:

subplot(2,2,4)
a47=-0.6875; %a=-(M+N+L)/(M+N)=-(4+7+9)/(4+7)=-20/11=-1.818
n=0:200; %(L+M+N)*10=(7+4+7)*10=18*10=180
y=a47.^n;
stem(n,y);
title('Subplot 3');
xlabel('Sample Position of ET173047');
ylabel('Amplitude')

8
Analysis:

For Subplot:1

Here For the 1st exponential sequence, amplitude is 0.916 and sample position is 0 to 180. So, its full fill the
0<a<1 condition for all ‘n’. Which mean this will be an exponential decay sequence and to plot it I use “stem”
command.

For Subplot:2

Here For the 1st exponential sequence, amplitude is 1.09 and sample position is 0 to 200. . So, its full fill the

9
10

You might also like