Waqas Naseem
Waqas Naseem
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
: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
clf;
stem(n,x);
axis([0 40 -2 2]);
grid;
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;