0% found this document useful (0 votes)
48 views

DSP Lab Report 1

This document contains a lab report submitted by Hasham Bin Aamir to Madam Nida Rasheed on September 22, 2011. The report details 9 MATLAB functions and scripts related to digital signal processing topics like averaging, impulse sequences, step sequences, and plotting signals. Functions are provided to calculate averages, generate impulse and step sequences, shift signals, and plot sinusoidal waves. Examples are given applying these functions to analyze and visualize different digital signals.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

DSP Lab Report 1

This document contains a lab report submitted by Hasham Bin Aamir to Madam Nida Rasheed on September 22, 2011. The report details 9 MATLAB functions and scripts related to digital signal processing topics like averaging, impulse sequences, step sequences, and plotting signals. Functions are provided to calculate averages, generate impulse and step sequences, shift signals, and plot sinusoidal waves. Examples are given applying these functions to analyze and visualize different digital signals.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Digital Signal Processing

Lab # 1

Hasham Bin Aamir


Sp08-Bet-027

Submitted To:
Madam Nida Rasheed
Date : 22/09/11

Comsats Institute Of
Information Technonlogy,

Islamabad
1)
function y=avge(x)
x=[1 2 3 4 5]
n=length(x)
t=sum(x)
y=t/n

2)Impulse Sequence:
function [x,n]=impseq(n0,n1,n2)
n=n1:n2
for i=1:length(n)
if i==n0
x(i)=1
else
x(i)=0
end
end

3)Step Sequence:
function [x,n]=impstep(n0,n1,n2)
n=n1:n2
for i=1:length(n)
if i>=n0
x(i)=1
else
x(i)=0
end
end

4)Average:
function [x,n]=impstep(n0,n1,n2)
n=n1:n2
for i=1:length(n)
if i>=n0
x(i)=1
else
x(i)=0
end
end

5)Average with user input:


for i=1:5
input("Enter Numbers",x )
end
y=avge1(x)

6)Script4:
n0=10
n1=1
n2=20
n=n1:n2
[x,n]=impseq(n0,n1,n2)
subplot(2,1,1)
stem(n,x)

7)Sigshift:
no=10
n1=1:10
x=1:10
[y,n]=sigshift(x,n0,n1)
stem(n,x)

8)Home Task 1:
t=0:10:50
f=30
%%a=2*pi*f*t
%%b=pi/4
y=sin((2*pi*f*t)+(pi/2))
subplot(2,1,1)
stem(t,y)

9)Home Task 2:
t=0:10:50
f=30
%%a=2*pi*f*t
%%b=pi/4
y=sin((2*pi*f*t)+(pi/2))

subplot(2,1,1)
stem(t,y)

You might also like