The document contains MATLAB code for signal processing lab experiments. It includes code to:
1. Generate and plot sequences based on the user's roll number.
2. Define custom functions to generate basic sequences like unit sample, unit step, exponential rise and decay.
3. Plot signals together and manipulate signals using operations like convolution.
4. Quantize signals and calculate signal-to-quantization noise ratio (SQNR).
5. Perform operations like filtering using transfer functions and z-transforms.
6. Implement the discrete Fourier transform and inverse discrete Fourier transform using a custom function.
Digital Signal Processing using Open Source Scilab. It covers more than 20 experiments. This slide is in PDF format. It gives idea for those who wants to scilab for signal processing applications
Applied Digital Signal Processing 1st Edition Manolakis Solutions Manualtowojixi
Full download http://alibabadownload.com/product/applied-digital-signal-processing-1st-edition-manolakis-solutions-manual/
Applied Digital Signal Processing 1st Edition Manolakis Solutions Manual
Digital Signal Processing using Open Source Scilab. It covers more than 20 experiments. This slide is in PDF format. It gives idea for those who wants to scilab for signal processing applications
Applied Digital Signal Processing 1st Edition Manolakis Solutions Manualtowojixi
Full download http://alibabadownload.com/product/applied-digital-signal-processing-1st-edition-manolakis-solutions-manual/
Applied Digital Signal Processing 1st Edition Manolakis Solutions Manual
Digital signal Processing all matlab code with Lab report Alamgir Hossain
Digital signal processing(DSP) laboratory with matlab software....
Problem List :
1.To write a Matlab program to evaluate the impulse response of the system.
2.Computation of N point DFT of a given sequence and to plot magnitude and phase spectrum.
3.To Generate continuous time sinusoidal signal, discrete time cosine signal.
4.To find the DFT / IDFT of given signal.
5.Program for generation of Sine sequence.
6.Program for generation of Cosine sequence.
7. Program for the generation of UNIT impulse signal
8. Program for the generation of Exponential signal.
C program to find factorial of number using recursion as well as iteration ,
Calculate power of a number program in c using Recursion and Iteration, Write a C program to count digits of a number using Recursion and Iteration, Write a C program to find sum of first n natural numbers using Recursion, C program to print sum of digits of a given number using recursion ,Write a C program to find nth term in Fibonacci Series using Recursion, C program to find out the GCD (Greatest Common Divisor )of the two numbers using recursion,
Write a C program to find the first upper case letter in the given string using recursion, write C program to calculate length of the string using Recursion ,
Write a program in C to count number of divisors of a given number using recursion, Recursive program to check whether a given number is prime or composite,
C program to displays integers 100 through 1 using Recursion and Iteration, Write a program in C to convert a decimal number to binary using recursion,
Recursion Stack of factorial of 3 Recursion stack of 4th term of Fibonacci
17, r) -,r I : -l
19.t:...: 1
21.2t-31:4
/ 23. ^t: -rr - 1)t I,r r.= ll-vl
11 1
Evaluating a Function In Exercises 29-14, evaluate the
function at each specified value of the independent
variable and simplify.
29.fO-3t+t
(a) f(2) (b) /(-4) (c) f(r + 2)
30. s(y) :1 - 3y
(a) s(o) tul s(l) (c) s(s + 2)
tlzt.t(t):t2-2t
(a) h(.2) ft) /,(1.s) (c) h(x + 2)
32. v(r) - !rr3
(a) v(3) (b) Y(;) k) v(2r)
33./(.-r)::-./y
@) f(a) (u) l(0.2s) (c') [email protected])
3a.f(x)- aE+8+2
(a) f (-+) (b) /(8)
1
' x'-9
(a) q(-3) (b) q(z)
)t2+\
36. ./(r)- t'
(il qQ) 0) q(o)
lrl
37. i(r) : "'x
ar f(e) (b) /(-e)
38. -.,. : -r *4
: , -i (b) /(_5)
-, - l. x<0
'lq -, - l. .r > 0'\-
'\-
6r t(0)
', - -:. -r < 0t.
> |
1..
1OG Chapter I Functjons and Their Graphs
Testing for Functions Represented Algebraically In
Exercises 77-28. determine whether the equation
represents,r' as a function of r.
18.x:]2+1
20. y :-lf+ 5
22.r:-.y+5
24.r'l!2:3
20. lyl :1-x
28.r,:8
(c) /(x - 8)
(c) q(y + 3)
(.c) q(.- x)
(c) /(t)
(c) f(t)
(c) JQ)
,cl .f(l)
Evalr.rating a Fr.lnction In Exercises 45-48, assume that
the domain of/is the setA = {-2, - 1, 0, 1, 2}. Determine
the set of ordered pairs representing the function/.
[.rr-4. x<o42.fG)-1r_r,., r>0L1 - i.\
(il f?2) (b) /(0)
[.r- ]. t<0
I
a3.f(x)-1a. 0<r<2
L*, + t. r > 2
(a) .f(.-2) (b) /(1)
(s - ), r < otJ
44. ffrr --]s. us r < I
l.+*- r, r2 l
(a) J(. 2) (b) /(])
(c) /(1)
@ f(a)
(c) f(t)
a6. .f(.x) : x2 - 3
as. /(x) : lx + 1l
45. f(x) - x2
a7. f(x): lxl + z
Evaluating a Function In Exercises 49 and 50, complete
the tahle.
4s. h(t): llr + :l
l" - ?l50..f(r) -:
Finding the lnputs That Have Outputs of Zers In
Exercises 51-54, find all values of x such that/(r) = g'
st. 16) : 15 - 3x 52. f(x): 5r * I
3r-4
sa. f(x') - 2r-3s3. /(x) :
Finding the Dornain of a Function In Exercises 55-6J.
find the domain of the function.
,l ss. fG): 5x2 + 2x - | s6. s(ir) : 7 - 2x2
4-3v
57. hhl - ' 58. ,s( r') -I y-)
se. /(x) - 1C - 1 60. /(x) : X/" + 3x
. t 3 l0
{ el. gtrt - ' - 62. h(r) - .., 1..I f t- i LA
r'*2 -,8+6
64./(:r) :--' o f .t
t -5 -4 -3 -1
It(r)
,t 0 l2
I
2
4
/(')
63. s(.v) : 5- 10
the Domain and Range of a Function In 1)
mriffs 65-68, use a graphing utility to graph the
hhu Find the domain and range of the function.
. ,.-
-E' - \
+ i 66. f(x): 1F I 1
68. g(x) : I, - sl.j1- -r,-; : i1r + 3l
I. Geometry Write the areaA of a circle as a function of
rs --ircumference C.
il" Cmmetry Write the arca A of an equilaterai tiangle
"ts i tunction of the length s of its sides.
1!- E4loration An open box of maximum volume is to
s made from a square piece of mateial, 24 centimeters
cm a side, by cutting equal squares from the corners and
uuia-e up the sides (see figure).
,"1 , The table shows the volume 7 (in cubic centimeters)
of the box for various heights x (in centimeters).
L-se the table to estimate the maximum volume.
i Plot the points (x, I/) from the table in part (a). Does
rtre relation defined.
Tucker tensor analysis of Matern functions in spatial statistics Alexander Litvinenko
1. Motivation: improve statistical models
2. Motivation: disadvantages of matrices
3. Tools: Tucker tensor format
4. Tensor approximation of Matern covariance function via FFT
5. Typical statistical operations in Tucker tensor format
6. Numerical experiments
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
Digital signal Processing all matlab code with Lab report Alamgir Hossain
Digital signal processing(DSP) laboratory with matlab software....
Problem List :
1.To write a Matlab program to evaluate the impulse response of the system.
2.Computation of N point DFT of a given sequence and to plot magnitude and phase spectrum.
3.To Generate continuous time sinusoidal signal, discrete time cosine signal.
4.To find the DFT / IDFT of given signal.
5.Program for generation of Sine sequence.
6.Program for generation of Cosine sequence.
7. Program for the generation of UNIT impulse signal
8. Program for the generation of Exponential signal.
C program to find factorial of number using recursion as well as iteration ,
Calculate power of a number program in c using Recursion and Iteration, Write a C program to count digits of a number using Recursion and Iteration, Write a C program to find sum of first n natural numbers using Recursion, C program to print sum of digits of a given number using recursion ,Write a C program to find nth term in Fibonacci Series using Recursion, C program to find out the GCD (Greatest Common Divisor )of the two numbers using recursion,
Write a C program to find the first upper case letter in the given string using recursion, write C program to calculate length of the string using Recursion ,
Write a program in C to count number of divisors of a given number using recursion, Recursive program to check whether a given number is prime or composite,
C program to displays integers 100 through 1 using Recursion and Iteration, Write a program in C to convert a decimal number to binary using recursion,
Recursion Stack of factorial of 3 Recursion stack of 4th term of Fibonacci
17, r) -,r I : -l
19.t:...: 1
21.2t-31:4
/ 23. ^t: -rr - 1)t I,r r.= ll-vl
11 1
Evaluating a Function In Exercises 29-14, evaluate the
function at each specified value of the independent
variable and simplify.
29.fO-3t+t
(a) f(2) (b) /(-4) (c) f(r + 2)
30. s(y) :1 - 3y
(a) s(o) tul s(l) (c) s(s + 2)
tlzt.t(t):t2-2t
(a) h(.2) ft) /,(1.s) (c) h(x + 2)
32. v(r) - !rr3
(a) v(3) (b) Y(;) k) v(2r)
33./(.-r)::-./y
@) f(a) (u) l(0.2s) (c') [email protected])
3a.f(x)- aE+8+2
(a) f (-+) (b) /(8)
1
' x'-9
(a) q(-3) (b) q(z)
)t2+\
36. ./(r)- t'
(il qQ) 0) q(o)
lrl
37. i(r) : "'x
ar f(e) (b) /(-e)
38. -.,. : -r *4
: , -i (b) /(_5)
-, - l. x<0
'lq -, - l. .r > 0'\-
'\-
6r t(0)
', - -:. -r < 0t.
> |
1..
1OG Chapter I Functjons and Their Graphs
Testing for Functions Represented Algebraically In
Exercises 77-28. determine whether the equation
represents,r' as a function of r.
18.x:]2+1
20. y :-lf+ 5
22.r:-.y+5
24.r'l!2:3
20. lyl :1-x
28.r,:8
(c) /(x - 8)
(c) q(y + 3)
(.c) q(.- x)
(c) /(t)
(c) f(t)
(c) JQ)
,cl .f(l)
Evalr.rating a Fr.lnction In Exercises 45-48, assume that
the domain of/is the setA = {-2, - 1, 0, 1, 2}. Determine
the set of ordered pairs representing the function/.
[.rr-4. x<o42.fG)-1r_r,., r>0L1 - i.\
(il f?2) (b) /(0)
[.r- ]. t<0
I
a3.f(x)-1a. 0<r<2
L*, + t. r > 2
(a) .f(.-2) (b) /(1)
(s - ), r < otJ
44. ffrr --]s. us r < I
l.+*- r, r2 l
(a) J(. 2) (b) /(])
(c) /(1)
@ f(a)
(c) f(t)
a6. .f(.x) : x2 - 3
as. /(x) : lx + 1l
45. f(x) - x2
a7. f(x): lxl + z
Evaluating a Function In Exercises 49 and 50, complete
the tahle.
4s. h(t): llr + :l
l" - ?l50..f(r) -:
Finding the lnputs That Have Outputs of Zers In
Exercises 51-54, find all values of x such that/(r) = g'
st. 16) : 15 - 3x 52. f(x): 5r * I
3r-4
sa. f(x') - 2r-3s3. /(x) :
Finding the Dornain of a Function In Exercises 55-6J.
find the domain of the function.
,l ss. fG): 5x2 + 2x - | s6. s(ir) : 7 - 2x2
4-3v
57. hhl - ' 58. ,s( r') -I y-)
se. /(x) - 1C - 1 60. /(x) : X/" + 3x
. t 3 l0
{ el. gtrt - ' - 62. h(r) - .., 1..I f t- i LA
r'*2 -,8+6
64./(:r) :--' o f .t
t -5 -4 -3 -1
It(r)
,t 0 l2
I
2
4
/(')
63. s(.v) : 5- 10
the Domain and Range of a Function In 1)
mriffs 65-68, use a graphing utility to graph the
hhu Find the domain and range of the function.
. ,.-
-E' - \
+ i 66. f(x): 1F I 1
68. g(x) : I, - sl.j1- -r,-; : i1r + 3l
I. Geometry Write the areaA of a circle as a function of
rs --ircumference C.
il" Cmmetry Write the arca A of an equilaterai tiangle
"ts i tunction of the length s of its sides.
1!- E4loration An open box of maximum volume is to
s made from a square piece of mateial, 24 centimeters
cm a side, by cutting equal squares from the corners and
uuia-e up the sides (see figure).
,"1 , The table shows the volume 7 (in cubic centimeters)
of the box for various heights x (in centimeters).
L-se the table to estimate the maximum volume.
i Plot the points (x, I/) from the table in part (a). Does
rtre relation defined.
Tucker tensor analysis of Matern functions in spatial statistics Alexander Litvinenko
1. Motivation: improve statistical models
2. Motivation: disadvantages of matrices
3. Tools: Tucker tensor format
4. Tensor approximation of Matern covariance function via FFT
5. Typical statistical operations in Tucker tensor format
6. Numerical experiments
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
DSP LAB COMPLETE CODES.docx
1. Lab-1
Q1 generate and plot each of the followingseqencesoverthe interval –n:n determinedbyyour roll
numberas shown below
1)
clc
clearall
close all
n=(58/2)+5
N=-n:1:n
x=2*(N==-2)-(N==4)
stem(N,x)
xlabel('Time')
ylabel('Amplitude')
title('Graphof x')
Q2 generate the followingcomplex valuedsignal and plotits magnitudesphase and the real part and
the imajinarypart in four separate subplots…
X4(n)=e^(-0.1+j0.3)n
clc
clearall
close all
n=(58/2)+5
N=-n:1:n
x= N.*((N>=0) - (N>=10)+( (10.*exp(-0.3*(N-10))).*((N>=10)-(N>=20) ) ) )
stem(N,x)
xlabel('Time')
ylabel('Amplitude')
title('Graphof x')
Q2
clc
clearall
close all
n=(58/2)+5
N=-n:2:n
x=exp((-0.1+j*0.3)*N)
subplot(2,2,1)
stem(N,abs(x))
xlabel('Time')
ylabel('Amplitude')
3. end
task1(c)
rise function
function [x,n] = exp1( n0,n1,n2 )
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
n=[n1:n2]%range
x=[exp(n-n0)]
stem(n,x)
end
task1(d)
decay funtion
function [x,n] = exp1( n0,n1,n2 )
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
n=[n1:n2]%range
x=[exp(-1.*(n-n0))]
stem(n,x)
end
write matlab recursive function code to compute the factorial of
number .also verify ur function
task 2 (a)
function [y] =fact( x )
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
if x>1
n = 1
y=x*fact(x-1)
else
y=1
end
4. Plot the following two signals together in the same plot
X1(t)=cos(t) and x2(t)=sin(t+pi/2)
Where t=0 to 2sec
pre lab task 3(a)
clc
close all
clear all
t=0:2
x1=cos(t)
x2=sin(t+(pi/2))
plot(t,x1,'G')
title('cosine signal')
xlabel('time')
ylabel('amplitude')
grid on
hold on
plot(t,x2,'R*')
xlabel('time')
ylabel('amplitude')
legend('sin(t+(pi/2))','cos(t)')
grid on
pre lab task 3(b)
clc
close all
clear all
t=0:2
x1=3.*cos(3*pi*t+(pi/3))
plot(t,x1,'G')
title('cosine signal')
xlabel('time')
ylabel('amplitude')
legend('3.*cos(3*pi*t=(pi/3))')
grid on
Q1 generate and plot each of the followingseqencesoverthe interval –n:n determinedbyyour roll
numberas shown below
pre lab task 1(a)
clc
close all
clear all
n=57
x1=2.*((n)==2)-((n)==4)
5. stem(n,x1,'G')
title('functi0n ')
xlabel('time')
ylabel('amplitude')
legend('2*((n-2)==0)-((n-4)==0)')
grid on
Lab 2
Task 1
Consider the following continuose time sinusoidal signal
Xa(t)=cos(2pi f t) 0<=t<=2
Plot the discrete time signal x(n),0<=n<=19 for sampling frequency Fs=100H and f=10,50 and
90 Hz compare the graph by identifying similarities and differences .
clc
clearall
closeall
Fs=100
t=1/Fs
n=0:t:19.*t
f=10
f1=50
f2=90
x1=cos(2.*pi.*f.*n)
x2=cos(2.*pi.*f1.*n)
x3=cos(2.*pi.*f2.*n)
subplot(3,1,1)
stem(n,x1)
xlabel('Time')
ylabel('Amplitude')
legend('x1=cos(2.*pi.*f.*n)')
title('GRAPH OF x1')
subplot(3,1,2)
stem(n,x2)
xlabel('Time')
7. figure
stem(t,error)
ylim([-5 5])
xlabel('Time')
ylabel('Amplitude')
legend('Error')
title('GRAPH OF ERROR')
figure
stem(t,x)
ylim([-5 5])
xlabel('Time')
ylabel('Amplitude')
legend('Sample')
title('GRAPH OF SAMPLE')
c)Quantize the sampled signal x(n) for f=100Hz using 4,5 and 6 bits respectively ,compute the
difference in the output by computing SQNRT
clc
clearall
closeall
f=100
n1=4
n2=5
n3=6
L1=2^n1
L2=2^n2
L3=2^n3
t=0:(1/(pi)):2
x=cos(2*pi*f*t)%
D1=[(max(x)-min(x))]/L1
D2=[(max(x)-min(x))]/L2
D3=[(max(x)-min(x))]/L3
xq1=quant(x,D1)%
xq2=quant(x,D2)
8. xq3=quant(x,D3)%
error1=x-xq1
error2=x-xq2
error3=x-xq3
SQNR1=10.*log10(sum(x.^2)/sum(error1.^2))
SQNR2=10.*log10(sum(x.^2)/sum(error2.^2))
SQNR3=10.*log10(sum(x.^2)/sum(error3.^2))
Task 2
Given the digital speech signal in the file guitartune wav write a Matlab program to
a) Read the audio file and find sampling frequency
b) Quantize x(z) using 4 bit quantizers to obtain the quantized signal xq, assuming the signal
range isfrom -1 to 1 volts
c) plot the original speech and quantization error.
d) calculate the SQNRT
clc
clearall
closeall
[x,fs]=audioread('guitartune.wav')
n=4
L=2.^n
t=0.1:length(x-1)
D=[1-(-1/L)]
xq=quant(x,D)
error=x-xq
subplot(3,1,1)
stairs(t,xq)
xlabel('Time')
ylabel('Amplitude')
legend('Quantized')
title('GRAPH OF xq')
subplot(3,1,2)
stem(t,error)
xlabel('Time')
ylabel('Amplitude')
legend('Error')
title('GRAPH OF ERROR')
subplot(3,1,3)
stem(t,x)
xlabel('Time')
9. ylabel('Amplitude')
legend('Sample')
title('GRAPH OF SAMPLE')
SQNR=10.*log10(sum(x.^2)/sum(error.^2))
TASK 3
1.Write your own custome function which is able to simulate a uniform quantizer .the inputs
should contain sampled signal numberof bits used in quantization and return quantized and
error signal
2.write ur own custom function which able to the SQNRT due to
quantization
function [ error, xq, SQNR ] = q( x, n)
L=2.^n
D=(max(x)-min(x))/L
xq=quant(x,D)
error=x-xq
SQNR=10.*log10(sum(x.^2)/sum(error.^2))
end
or
function [ error, xq, SQNR ] = q( x, n)
% Quantized
max=20
min=0
L=2.^n
D=(max-min)/L
xq=quant(x,D)
error=x-xq
SQNR=10.*log10(sum(x.^2)/sum(error.^2))
end
Lab 3
Task 1
Given the following two sequence determine the convolution
y[n].plot each step in the subplot.
X[n]=[3,11,7,0,-1,4,2] -3<=n<=3; h[n]=[2,0,-5,2,1] -1<=n<=4
clc
clearall
closeall
10. x=[3 11 7 0 -1 4 2]
h=[2 3 0 -5 2 1]
n1=[-3:3]
n2=[-1:4]
c=conv(x,h)
subplot(3,1,1)
stem(n1,x)
xlabel('Time')
ylabel('Amplitude')
legend('x')
title('GRAPH OF x')
subplot(3,1,2)
stem(n2,h)
xlabel('Time')
ylabel('Amplitude')
legend('h')
title('GRAPH OF h')
subplot(3,1,3)
stem(c)
xlabel('Time')
ylabel('Amplitude')
legend('y(n)=x(n)*h(n)')
title('GRAPH OF x(n)*h(n)')
Task-2
Write a matlab fuctionto systematicallydevelopthe sequence y[n]generatedbythe convolutionof
the two finite lengthsequence x[n]andh[n] program shouldbe able to handle causal and non causal
sequences.youshouldverifythis functionalityof the program .program shouldcall for the input
sequencesandtheir indicesvectors
function [ y,ny ] = convo_1(nx,nh,x,h )
ny1=nx(1)+nh(1)
ny2=nx(length(x))+nh(length(h))
ny=[ny1:ny2]
y=conv(x,h)
end
Task3:
11. lab 4
clc
clear all
close all
num=[4 3 9]
den=[4 3 -4]
H=num/den
[R,p,K] = residuez(num,den) [z,p,K] = tf2zp(num,den)
zplane(z,p
[sos,g]=zp2sos(z,p,K)
TASK 1
Determine the rational Z-Transform from its polesand zero locations.The zeros are at ζ1 = 0.21, ζ2 =
3.14 , ζ3 = −0.3 + 𝑗 0.5 , ζ4= −0.3 − 𝑗0.5 And polesare at 𝜆1= −0.45 , 𝜆2 = −0.67, 𝜆3= 0.81 + 𝑗 0.72 , 𝜆4=
0.81 − 𝑗0.72 and the gain constant is 2.2.
clc
clear all
close all
z=[0.21;3.14;-0.3+0.5i;-0.3-0.5i]
p=[-0.45;-0.67;0.81+0.72i;0.81-0.72j]
k=2.2
[num,den] = zp2tf(z,p,k)%
tf(num,den,-1)
12. task 2
UsingMATLAB, determine the partial fraction expansionofthe z transform (𝑧),givenby
clc
clear all
close all
syms z
num=[18 0 0 0]
den=[18 3 -4 -1]
Hz=num/den
[r,p,K] = residuez(num,den) //for partial fraction
p=[(r(1)/(1-p(1).*z.^(-1)))+(r(2)/(1-p(2).*z.^(-1)))+(r(3)/(1-p(3).*z.^(-
1)))]
pretty(p)
task 3
Determine the rational form of z transform from its partial fraction expansion of the
following z transforms and then determine theirinverse z transform. Write down your
analysis.
clc
clear all
close all
num=[1 -1 0]
den=[1 1.3 0.3]
[R,p,K] = residuez(num,den)
[z,p,K] = tf2zp(num,den)
zplane(z,p)
13. zplane(z,p)
A) casual andmarginal stable
B) Anti-causal andunstable b/cnotinclude unitcircle
C) non-causal andstable
Lab 6
pre lab
Write a MATLAB functionto compute K-pointDFT and IDFT of N-pointsequence.The function should
take sequence (array),integervalue K and binary value switchto decide ifto compute DFT or IDFT.
The functionshouldreturn the sequence aftercomputation.
function [y] = lab6(x,N,b )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
if b==1
n=[0:1:N-1]
k=[0:1:N-1]
WN=exp(-j*2*pi/N)
nk=n'*k
WNnk=WN.^nk
y=x*WNnk;
else if b==0
n=[0:1:N-1]
k=[0:1:N-1]
WN=exp(-j*2*pi/N);
nk=n'*k
WNnk=WN.^(-nk);
y=x*WNnk/N;
end
end
task-1
Compute the M-pointDFT of the followingN-pointsequence.
u(n)={1 ,0<=n<=N-1
0 , otherwise}
compute the M pointDFT
clc
14. close all
clear all
N=5
M=7
n=0:1:N-1
x=1.*(n>=0)
y=dft(+x,M,N)
task-3
Write a MATLAB program to compute the circular convolution oftwo length- N sequences via
DFT based approach. Using this program determine the circular convolution ofthe following pairs
of sequences.
a) 𝑔[𝑛] = {3 ,4 − 2 ,0 , 1 , −4} , ℎ[𝑛] = { 1,−3, 0,4 , −2 , 3}
b)x[n]=sin(pi*n)/2,y[n] =(roll number)^n 0<=n<=4
clc
close all
clear all
g=[3,4'-2,0,1,-4]
h=[1,-3,0,4,-2,3]
c=cconv(g,h)
stem(c)
:
question
function [y] = lab6( x,N,b )
%b is the value of switch
if b==1
18. >>
Lab 7
TASK-1
Write MATLAB code that determines and plot the N-point Discrete Fourier Transform of
x[n]defined by the following equations:
x(n)=sin(0.5pi*n), 0<=n<=16
Compute and plot 16-point DFT usingtwo 8-pointFFTs and combiningtechniques.
function [y]=fft16(x)
%stage1
for n=0:1:7
twiddle=exp(-2*pi*j*n*1/16)
x1(n+1)=x(n+1)+x(n+9)
x1(n+9)=(x(n+1)-x(n+9))*twiddle;
end
%stage 2
for n=0:1:3
twiddle=exp(-2*pi*j*n*1/8)
x2(n+1)=x1(n+1)+x1(n+5)
x2(n+5)=(x1(n+1)-x(n+5))*twiddle;
x2(n+9)=x1(n+9)+x1(n+13);
x2(n+13)=x1(n+9)-x1(n+13)*twiddle;
end
%stage 3
for n=0:1:1
twiddle=exp(-2*pi*j*n*1/4)
x3(n+1)=x2(n+1)+x2(n+3)
x3(n+3)=(x2(n+1)-x2(n+3))*twiddle
x3(n+5)=x2(n+5)+x2(n+7)
x3(n+7)=(x2(n+5)-x2(n+7))*twiddle
x3(n+9)=x2(n+9)+x2(n+11)
x3(n+11)=(x2(n+9)-x2(n+11))*twiddle
x3(n+13)=x2(n+13)+x2(n+15)
x3(n+15)=(x2(n+13)-x2(n+15))*twiddle
end
%stage 4
twiddle=exp(-2*pi*j*n*1/2)
x4(1)=x3(1)+x3(2)
x4(2)=(x3(1)-x3(2))*twiddle
x4(3)=x3(3)+x3(4)
x4(4)=(x3(3)-x3(4))*twiddle
x4(5)=x3(5)+x3(6)
20. nu = ceil(log10(N*I)/log10(2)); N = 2^nu;
for I=1:100
h = randn(1,L); x = rand(1,L);
t0 = clock; y1 = conv(h,x); t1=etime(clock,t0); tc = tc+t1;
t0 = clock; y2 = ifft(fft(h,N).*fft(x,N)); t2=etime(clock,t0);
tf = tf+t2;
end
%
conv_time(L)=tc/100; fft_time(L)=tf/100;
end
n=1:150;
subplot(1,1,1);
plot(n(25:150),conv_time(25:150),n(25:150),fft_time(25:150))
TASK-3
Write a MATLAB functionto implementablock convolutionalgorithm calledthe overlap-and-save
method(and its companion the overlap-and-addmethod),whichis usedto convolve a very large
sequence witha relativelysmallersequence.
Function [y] = ovrlpsav(x,h,N)
% Overlap-Save method of block convolution
% ----------------------------------------
% [y] = ovrlpsav(x,h,N)
% y = output sequence
% x = input sequence
% h = impulse response
% N = block length
Lenx = length(x)
M = length(h)
M1 = M-1; L = N-M1
h = [h zeros(1,N-M)]
%
x = [zeros(1,M1), x, zeros(1,N-1)] % preappend (M-1) zeros
K = floor((Lenx+M1-1)/(L)) % # of blocks
Y = zeros(K+1,N)
% convolution with succesive blocks
for k=0:K
xk = x(k*L+1:k*L+N)
21. Y(k+1,:) = circonvt(xk,h,N)
end
Y = Y(:,M:N) % discard the first (M-1) samples
y = (Y(:))' ; % assemble output
TASK-4
Usingthe functionof task 3, write a MATLAB program to implementlength-Nmovingaverage filterto
filtera noise corrupted signal. Where Nis class Roll Number.
clc
clear all
close all
n=1:5
s=n*pi
subplot(221)
stem(s)
title('original signal')
d=rand(1,5)
subplot(222)
stem(d)
title('noise ')
p=ovrlpsav(s,d,6),
subplot(223)
stem(p)
title('corrupted signal')
m=5
xu=0
for i=1:m
x=s+d
xu=xu+x
end
xu=xu/m
subplot(224)
stem(xu)
title('filtered signal')
lab 8
Task 1
Build a SIMULINK model for Sampling and Reconstruction ofanalog signal
where,
R = Your Reg. Number
i i) Sample the analog signal x(t) at 8 times the Nyquistrate.
22. ii ii) Non-uniformly quantize the discrete time signal using μ-lawcompanding method, μ=255
and number of quantization levels = 16.
iii iii) Encode and Decode the signal into binary.
iv iv) Reconstruct the analog signal.
v v) Show both time and frequency domain results.
% A simple sampling and reconstruction model for students
% beginners of Digital Signal Processing
% by Mukhtar Hussain (Email: mukhtarhussain@ciitlahore.edu.pk)
% f - The frequency of analog sinosoid signal
% F - Sampling Rate
% qbits - Number of Quantizations bits
% A - Amplitude of sinusoid signal
% L - Number of quantization levels based on qbits
% I - Quantization Interval
% sim_time - Simultaion Time
% span - x-axis range of frequency plot 1 & 3 (spectrum scope 1 & 3)
% span1 - x-axis range of frequency plot 2 (spectrum scope 2)
% NFFT - Number of FFT points
clc;
clear;
close all;
f = input('Enter the frequency of signal = ');
F = input('Enter the sampling frequency = ');
A = input('Enter max amplitude of signal = ');
qbits = input('Enter the number of quantization bits = ');
fc = input('Enter the lowpass filter cutoff frequency = ');
L = 2^qbits;
I = 2*A/(L-1);
% Settings for
Spectrum Scope
span = 8*F;
span1 = 8*F;
NFFT = 256;
% To run simulink model
t = 1/f;
sim_time = 10*t;
sim('sampling.slx');
23. TASk 2
Write MATLAB Code to
i i) Plot discrete time sampled signal sampled at FS = 8R [] xn
ii ii) Non-uniformly quantize the discrete time signal using μ-lawcompanding method, μ=100
and number of bits = 8
iii iii) Encode the signal into discrete levels.
iv iv) Decode the signal from discrete level and reconstruct using spline and cubic
interpolation to
v v) Analyze which interpolation method performs better.
clc
clear all
close all
t=0:0.001:1
fm=10
fs=1000
N=8
L=2.^N
%message signals
x=sin(2*pi*fm*t)
figure
subplot 211
plot(t,x)
title('message signal')
xlabel('time')
ylabel('amplitude')
%pulse traain
d=0:1/50:1
y=pulstran(t,d,'rectpuls',0.001)
subplot 212
plot(t,y)
title('pulse train')
xlabel('time')
ylabel('amplitude')
%sampling
z=x.*y
figure
subplot 211
plot(t,z)
title('sampled signal')
xlabel('time')
ylabel('amplitude')
%quantization
D=[max(x)-min(x)]/(L-1)
xq=quant(x,D)
subplot 212
plot(t,xq)
title('quantized signal')
xlabel('time')
25. IIR
clc
clear all
close all
syms z
H1N=[2 0 2]
H1D=[1 -0.8 0.64]
H2N=[4 -2]
H2D=[1 -0.75]
H3N=[2 4 2]
H3D=[1 0 0.81]
A1=conv(H1N,H2N)
HN=conv(A1,H3N)
A2=conv(H1D,H2D)
HD=conv(A2,H3D)
num=round(HN,3)
den=round(HD,3)
H1=dfilt.df1(num,den)
fvtool(H1)
H2=dfilt.df2(num,den)
fvtool(H2)
H3=dfilt.cascade(H1,H2)
fvtool(H3)
FIR
% phase responce linearhotaha
% num hotaha or den1 hota ha
clc
clear all
close all
syms z
H1N=[2 0 2]
26. H1D=[1 -0.8 0.64]
H2N=[4 -2]
H2D=[1 -0.75]
H3N=[2 4 2]
H3D=[1 0 0.81]
A1=conv(H1N,H2N)
HN=conv(A1,H3N)
A2=conv(H1D,H2D)
HD=conv(A2,H3D)
num=round(HN,3)
den=round(HD,3)
H1=dfilt.dffir(num)
fvtool(H1)
H2=dfilt.dffirt(num)
fvtool(H2)
LAB 12
Task 1
Designa band pass Chebyshev Type II filter using analog prototyping. The order
of filter is 20 witha value of 60 dB stop band attenuationand 0.75dB pass band
ripple where, Pass band edge = 800Hz Stopband edge=2000HzSampling
frequency = 6000
%Chebyshev
clc
clear all
close all
Rp=0.75
Rs=60
fp=800
fst=2000
fs=6000
ft=fs/2
27. wp=fp/ft
wst=fst/ft
%chebbyshev
[n1,wn]=cheb1ord(wp,wst,Rp,Rs)
[num,den]=cheby1(n1,Rp,wn)
[H,w]=freqz(num,den,512,fs)
plot(w,20*log10(abs(H)))
title('Chebbyshev mag in dB')
task 2
Design a Digital Bandpass IIR filter using Analog filter prototype and
Frequency Transformation. The filter should have following
specifications: Minimum order of the filter Lab Experiment | 12
Muhammad Usman Iqbal |EEE324 | Digital Signal Processing Lab
Manual 83 Maximum passband = 0.5dB Minimum stopband
attenuation= 30 dB Pass band edge frequencies = (N-5) – (N+5) MHz
Stop band edge frequencies = (N-5.5) – (N+5.5) MHz Sampling rate of
8N MHz Where 𝑁 = { 10𝑅, 𝑖𝑓𝑅< 15 𝑅, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑤𝑒, 𝑀𝐻𝑧 𝑅 = 𝑌𝑜𝑢𝑟
𝑅𝑒𝑔. 𝑁𝑜. i) Give reason which filter type you would prefer based on
the specification ii) Compute the normalized passband and stopband
frequencies iii) Compute the order and transfer function of desired
filter iv) Properly present your results to show that your designed
filter meet the specification
%BANDPASS
clc