Waqas Naseem

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 10

NAME : WAQAS NASEEM

CLASS: BETE-##(TELECOM)
ROLL # S-####
SUBJECT: DSP
Program p1-1

n=-10:20
u=[zeros(1,10) 1 zeros(1,20)]
stem(n,u)
xlabel('time index n')
ylabel('unit sample sequence')
axis([-10 20 0 1 ])

Q#1.14
clf;
n=-10:20;
u=[zeros(1,10) 1 ones(1,20)];
stem(n,u);
xlabel('Time index n');
ylabel('Amplitude');
title('unit step sequence');
axis([-10 20 0 1.2]);

Q#1.5
Roll # S-3115
% Delay= 3+1=4

clf;
n=-10:20;
u=[zeros(1,14) 1 ones(1,16)];
stem(n,u);
xlabel('Time index n');
ylabel('Amplitude');
title('unit step sequece');
axis([-10 20 0 1.2]);

Advance=1+5=6
n=-10:20;
u=[zeros(1,4) 1 ones(1,26)];
stem(n,u);
xlabel('Time index n');
ylabel('Amplitude');
title('unit step sequence');
axis([-10 20 0 1.2]);

Q#1.17

clf
n=0:40
f=0.1
phase=0
a=1.5
arg=2*pi*f*n - phase
x=a*cos(arg)
clf
stem(n,x)
axis([0 40 -2 2])
grid
xlabel('Time index n');
ylabel('Amplitude');
title('Sinusoidal sequence');

Q#1.18
The frequency of this sequence is f=0.1..it can be
changed by putting other values,like f=1.2,3,4 etc.
For phase control

Parameter phase controls the ,phase of a sinusoidal


function
For amplitude:Parameter A controls the amplitude in this program .
A=1.5
Q#1.19
Length of the sequence is 0 to 40. Length can be changed by putting some other
values in (n). For example n= 0:50, the length is 0 to 50.
Q#1.21

:Axis
Axis command control axis scaling and appearence. AXIS([XMIN
XMAX YMIN YMAX]) sets scaling for the x- and y-axes on the current
.plot

:Grid
Grid command draw grid line on figure. GRID ON adds major grid lines to the
current axes. GRID OFF removes major and minor grid lines from the current axes
Q#1.22

sinusoidal sequence of frequency 0.9:


n=0:40;
f=0.9;
phase=0;
A=1.5;
arg=2*pi*f*n-phase;
x=A*cos(arg);
clf;
stem(n,x);
axis([0 40 -2 2])
grid

xlabel('Time index n');


ylabel('Amplitude');
title('Sinusoidal sequence');

sinusoidal sequence of frequency 1.1:


n=0:40;
f=1.1;
phase=0;
A=1.5;
arg=2*pi*f*n-phase;
x=A*cos(arg);

clf;
stem(n,x);
axis([0 40 -2 2]);
grid;

xlabel('Time index n');


ylabel('Amplitude');
title('Sinusoidal sequence');
Q#1.23
Roll # S-3115

clf
n=0:50
f=0.03
phase=50
a=1.1
arg=2*pi*f*n - phase
x=a*cos(arg)
clf
stem(n,x)
axis([0 40 -2 2])
grid
xlabel('Time index n');
ylabel('Amplitude');
title('Sinusoidal sequece');

Q#1.24
n=0:40;
f=0.1;
phase=0;
A=1.5;
arg=2*pi*f*n-phase;
x=A*cos(arg);
clf;
plot(n,x);
axis([0 40 -2 2]);

Q#1.25
n=0:40;
f=0.1;
phase=0;
A=1.5;
arg=2*pi*f*n-phase;
x=A*cos(arg);
clf;
stairs(n,x);

axis([0 40 -2 2]);
grid;

You might also like