SlideShare a Scribd company logo
Matlab Assignment Help
To get more info, Please
Visit : – https://www.matlabassignmentexperts.com/
E-Mail : – info@matlabassignmentexperts.com
Contact Us : – +1 678 648 4277
 F j
 
s c ra mb
l e
  F  j ( a    
s c ra m bl e d sp e e
c h
o ri g i n a l s
p e e c
Thus, a spectrum as shown on the left will be translated to that shown on the right. The decoder will restore
the correct frequency relationships.
Consider a component A sin(Ωt), wewant to translate it to A sin ((Ωa − Ω) t). From elementary trigonometry
A sin ((Ωa − Ω) t) = A (sin(Ωat) cos(Ωt) − cos(Ωat) sin(Ωt))
= A sin(Ωat) sin(Ωt + π/2) − A sin(Ωat + π/2) sin(Ωt)
which leads to the following time-domain processing to shift a single frequency component.
Problem 1:
A Mini-project: An Audio Scrambler
.Text-messaging is out-of-date! You and I have been communicating by sending voice-messages to each other as
“.wav” files. It’s not that I am paranoid, but everybody is out to get me! In particular, “they” have been intercepting
all of our voice messages. But we are going to outwit “them” by using MATLAB to scramble our voice messages
before sending them, making them unintelligible using a secret encoding scheme, and then wewill descrambling
the messages when we get them.
your task is to design and implement the speech encoder and decoder. the requirement is that the scrambled
message should occupy the same audio bandwidth (approximately 300 – 3000 Hz) as the original message, and
the descrambled message should have good fidelity.
We will use a frequency domain “mirroring” scheme, where the frequency components are flipped, so that high
frequencies are translated to low frequencies and vice-versa. A spectral com ponent with frequency Ω1 will be
translated to a new frequency Ωa − Ω1, where Ωa is known to the sender and recipient. The resulting waveform is
unintelligible until the frequency relationships have been restored. The scheme is shown below:
Signal Processing Continuous And Discrete
Matlab Assignment Help
A π/2 phase-shifter is easy to build for a single frequency, such as sin(Ωat) but when the input signal, such as a
speech signal, contains more than just a single component each spectral component must be shifted by 90◦. This
requires an all-pass filter with a constant phase shift, which is a difficult design task for a continuous filter.
Approximations as active or passive filters are available.
The Hilbert transformer is an all-pass filter with a transfer function
which is exactly what wewant. The following shows the scrambler implemented with a Hilbert transformer
Then G(jΩ) = F(j(Ωa − Ω).
Matlab Assignment Help
(a) Practical implementations of Hilbert transformers are approximations. For example, suppose an
implementation has ripple in its passband so that at a particular frequency Ωo the transfer function is
π
where δ is a perturbation from the ideal response. Find the output g(t) when the input is f (t) = A sin(Ωot).
Have any “spurious” spectral components been introduced? (You can do this with simple trigonometric
identities.)
(b) Your task is to design, implement, and test an audio scrambler and descrambler using this encoding technique:
•You should write a pair of MATLAB functions as follows:
y_scramble = encode(f_audio, Fs, Fa)
y_descramble = decode(y_scramble, Fs, Fa)
where f audio is a MATLAB array containing the audio file to be processed, Fs is the sampling frequency (Hz) of the
data in f audio, and Fa is the frequency (Hz) around which the spectrum is reflected. The first function should take
encode the file, the second restore the scrambled version to the original.
•We will supply you with two audio files (.wav) that you can download and use. One is an ordinary audio file
(PS8Raw.wav) that is to be to be scrambled and descrambled. The second is one that we have already scrambled
(PS8Scrambled.wav). These may be imported into your MATLAB workspace using the wavread() function
[f_audio,Fs,Nbits] = wavread(’myfile’)
see the MATLAB help.
•You should use the Parks-McClellan design function firpm() to design a Hilbert trans former that covers the
frequency span 300 – 3000 Hz. (The help on firpm() has an example) Be aware that the quality of you scrambling
will be affected by the pass-band ripple that you allow.
Matlab Assignment Help
•Don’t forget that the FIR Hilbert transformer is a causal linear-phase system, and that it MUST have an odd
length impulse response. You will need to add an equivalent delay filter in the other arm. Design an appropriate
FIR impulse response.
•The audio arrays will be large. Use ff t f i l t () to do the actual filtering operations.
•Let’s standardize on a reflection frequency Fa = 3500Hz.
•To test your scrambler, load the audio file, then compute and plot its magnitude spec trum. Then scramble the
file and plot its magnitude spectrum. Make sure it is what you expect. If there are any spurious
components, try to find why they are there, and fix them.
You should submit the following:
(a)Listings of your two functions.
(b) Details of your Hilbert transformer design, including plots of the pass-band ripple, and details of the phase
response.
(c)A summary of your approach, including the compromises you made in any design choices.
(d)Plots of the magnitude spectra of
1.The audio file in PS8Raw.wav.
2.Your scrambled version of PS8Raw.wav.
Matlab Assignment Help
3. The result of descrambling your scrambled version of PS8Raw.wav. Use fftshift() on the
spectra to make them more readable.
(e)You should upload three .wav files to the 2.161 MIT Server site in the homework section:
1.Your scrambled version of PS8Scrambled.wav.
2.Your descrambled version of PS8RawScrambled.wav.
3.The result of scrambling then descrambling PS8Raw.wav.
Be sure to name the files so that they are clearly identified as yours...
We will be available to help if you run into trouble.
Problem 2: An analog integrator has a transfer function H(s) = 1/s. Use the bilinear transform to find (a) the
discrete time transfer function H(z), and (b) the difference equation for this form of digital integrator.
Plot the frequency response functions of the resulting digital integrator.
Problem 3: A continuous band-pass filter is described by the transfer function
Derive a recursive computing formula (difference equation) for (1) a step-invariant, (2) a root matching, and (c) a
bilinear transform digital filter based on this system. Assume ΔT = 0.1s.
Problem 4: A digital filter is to be designed to the following specifications:
Matlab Assignment Help
.
(a)What is the order of the continuous filter if a Chebyshev design is used.
(b) Prewarp the critical frequencies to find the equivalent frequencies for use in the bilinear trans form with a
sampling frequency of 50,000 samples/sec.
(c) Use MATLAB to design a continuous Chebyshev Type 1 filter with the prewarped crical frequencies. Then use
the bilinear() function to compute the discrete time transfer function from the continuous prototype.
(d)Make frequency response and pole-zero plots for your resulting filter.
(e)Use MATLAB to convert the prototype design to a band-pass digital filter with a passband of 5-15 kHz.
Matlab Assignment Help
Problem 1:
The standard Hilbert transformer is defined as:
MATLAB uses the same definition and this can be verified by finding the phase of ω → 0+. The implemented
filter’s phase has a linear component added to the −π/2 value (for ω> 0).
Our filter has −π/2 phase shift and this corresponds to:
A sin ((Ωa −Ω) t) = A (sin(Ωat) cos(Ωt) −cos(Ωat) sin(Ωt))
= −A sin(Ωat) sin(Ωt −π/2) −A cos(Ωat) sin(Ωt)
We have to be careful in implementing the scrambler. The scrambler diagram corresponds to the below figure.
However, note that the audio play is not affected by sign of output (i.e. a signal is played the same as its negative
version).
(a) The delay in implementation does not affect this discussion. So we ignore it for this analysis. We consider a sinusoidal
component of input as f(t) = sin(Ωot). The output of filter would be |H(jΩo)|sin(Ωot+6 H(jΩo)) = (1+δ)sin(Ωot− π 2 ). We
follow this through above diagram to compute g(t):
Matlab Assignment Help
Solutions
As a result due to practical implementation, some “spurious” components are introduced at Ωa + Ωo.
The original signal has a (desired) audio frequency content of Ωo = 300 − 3000 Hz. In the beginning, we can pre-
process the audio file with a band-pass filter passing 300 − 3000 Hz contents and then follow it with the
scrambling process.
We use a Hilbert transformer with a pass-band equal to 300 to (Fs/2 − 300) Hz, where Fs is the sampling
frequency . The extended pass-band of the filter, is because a high-order (low-ripple) “firpm-built” Hilbert filter
requires a symmetric pass-band (see MATLAB doc umentation). After passing the audio file through our
transformer with Ωa = 3500 Hz, the output will have a large (desired) spectrum content at 500 − 3200 Hz and a
spurious content at 3800 −6500 Hz (which could be folded to some lower frequency). If δ is not small enough, we
might wish to post-process the filter output with a pass-band filter passing 500 − 3200 Hz contents and then save
it as scrambled signal. This post processing step of scrambling, can be considered as a pre-processing step of
desrcambling procedure.
Theoretically, descrambling is the same as scramblibg. However, the practical realization of the Hilbert filter is
bandwidth limited (while the ideal Hilbert filter is an all-pass filter). The Hilbert Filter for desrcambling,
requires a pass-band equal to 500 to (Fs/2 − 500) Hz. However, if we pre-process the srcambled signal with a
pass-band filter passing 500 − 3200 Hz contents, then we can use the same Hilbert filter for scrambling and
descrambling. The output of desrcambling can be further post-processed with a pass-band filter passing audio
contents (300 −300 Hz).
Matlab Assignment Help
(b) This is not the complete solution to all parts of the problem. This simply serves to show the approach. To
study the full solution start with attached Main.m file and follow other scripts. Note that the encoding and
decoding functions can be identical (if we use proper pre/post filters). Here is the encoding script:
function fout = encode(fin,Fs,Fc)
%%Design the Hilber transformer
% Note: firpm() seems to need the band edges to be symmetric about 0.5
h1=firpm(150,[300*2/Fs 1-300*2/Fs],[1 1 ],’Hilbert ’);
%h1=firpm(150,[500*2/Fs 1-500*2/Fs],[1 1 ],’Hilbert ’); %change in the decode file
y1=fftfilt(h1,fin);
%%Delay: Approach 1 N=length(h1); %Nis odd
y2=zeros(size(fin));y2((N-1)/2+1:end)=fin(1:end-(N-1)/2);
%% Delay: Design the delay filter, Approach 2
%h2 = zeros(1,length(h1));
%h2((N-1)/2+1) = 1;
%Filter the data
%y2=fftfilt(h2,fin);
%%Filter Output
t=(0:length(fin)-1)*(1/Fs);
y3=-y1.*sin(2*pi*Fc*t’);
y4=-y2.*cos(2*pi*Fc*t’);
fout= y3+y4;
The following graph shows one the encoder’s Hilbert transformer (order 150).
Matlab Assignment Help
Encoder Hilbert Filter for F =11.025 KHz
s
5
0
−5
−10
−15
−20
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Magnitu
de
(dB) Normalized Frequency ( rad/sample)
0
Phase
(
degrees
)
−5000
−10000
−15000
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
Normalized Frequency ( rad/sample)
0.8 0.9 1
We passed the input original audio through a band-pass filter (300-3000 Hz) to minimize the folding of high
frequencies. We used the same filter for the decoder output. We also used a band pass filter (500-3200 Hz) for
the encoder output or for the decoder input. These pass-band filters are implemented as a series of low and
high pass filters (all order 200). Otherwise, we could not build a nice pass band filter in a single step. All these
filters are shown on the next page
Note that following the original signal through all filters (audio filter, Hilbert, pre-decode, Hilbert and audio
filter), results in a delay equal to 750 samples ( 3 ∗(200/2 + 200/2) + 2 ∗(150/2) ). Although 750 might be a
large number, but even for our lowest Fs = 11.02 KHz, this means less then 0.07 second delay. This small delay is
hardly noticeable by our hearing system and hence our filter’s orders are not too large.
Matlab Assignment Help
Audio Filter (Post−Decoding or Pre−Encoding)
20
0
−20
−40
−60
−80
−100
−120
−140
Magnitu
de
(dB)
Magnitu
de
(dB)
−160
0
Low Pass: Fs=11.025 KHz
High Pass: Fs=11.025 KHz Low Pass:
Fs=22.05 KHz
High Pass: Fs=22.05 KHz
2000 4000 6000
Frequency (Hz)
8000 10000
Post−Encoding (Pre−Decoding) Filter
20
0
−20
−40
−60
−80
−100
−120
−140
−160
0 2000 4000
Low Pass: Fs=11.025 KHz
High Pass: Fs=11.025 KHz
Low Pass: Fs=22.05 KHz
High Pass: Fs=22.05 KHz
8000 10000
6000
Frequency (Hz)
The following plots resulted from working on PS8Raw.wav:
Matlab Assignment Help
Matlab Assignment Help
(3): Magnitude Spectrum of Encoder Output
4500
4000
3500
3000
2500
2000
1500
1000
500
0
−5000 −4000 −3000 −2000 −1000 0 1000 2000 3000 4000 5000
Frequency (Hz)
(4):
4000
3500
3000
2500
2000
1500
1000
500
0
−5000 −4000 −3000 −2000 −1000 0 1000 2000 3000 4000 5000
Frequency (Hz)
Magnitude Spectrum of Decoder Input (After Decoder Fitler)
4500
Matlab Assignment Help
(5): Magnitude Spectrum of Decoder Output
0 1000 2000 3000 4000 5000
0
−5000 −4000 −3000 −2000 −1000
4500
4000
3500
3000
2500
2000
1500
1000
500
Frequency (Hz)
(6): Magnitude Spectrum of Audio Fitered Decoder Output
0 1000 2000 3000 4000 5000
0
−5000 −4000 −3000 −2000 −1000
4500
4000
3500
3000
2500
2000
1500
1000
500
Frequency (Hz)
Comparing the input and decoded spectra shows them to be the same. In your solutions, we will be looking for
stray spectral components that may result from ripple in your Hilbert transformer response etc.
(4): Magnitude Spectrum of Decoder Input (After Decoder Fitler)
Matlab Assignment Help
Problem 2: (a) If H(s) = 1/s, then the bilinear transform (using Tustin’s approximation) gives:
(b) From above
which is the trapezoidal numerical integration rule.
The following MATLAB commands generate the frequency response:
b = [0.5 0.5];
a = [1 -1];
freqz(b,a)
title(’Bilinear Integrator’)
Matlab Assignment Help
Note that while the phase is constant at −π/2, the magnitude plot does not show a constant slope of -20 dB/decade as
does the analog integrator.
Problem 3:
(a) The plant
has (1) a zero at s = 0, and (2) a pair of coincident poles at s = −1. The root-matching (matched z-transform)
discrete-time system is
and with T = 0.1 sec.,
Matlab Assignment Help
To create a minimum delay filter, make the order of the numerator and denominator equal by adding a zero at the
origin:
The gain factor K must be determined empirically. This is normally done using the finalvalue theorem, but in this case
lims→0 H(s) = 0 and the final values cannot be compared. Some other amplitude criterion must be used; in this case the
peak value of the two step responses were compared and found to be 0.367 for the continuous system H(s) and 4.018
for the discrete system H(z). Then K = 0.367/4.018 = 0.0913.
Alternatively you might compare the response of the analog system to a ramp input r(t) = t with the analogous discrete
response to a ramp rn = 0.1n and use their final values to match the gains resulting in K = 0.097. The step responses with
K = 0.0913 are compared in the plot below
Matlab Assignment Help
Note the slight delay in the digital response.
(b) The system has repeated poles at s = −1. Then H(s) may be expressed in partial fractions as
and
As we discussed in class, this form of impulse invariant simulation suffers from a gain error, and a correction
is more frequently used. The step responses of H(s) and H ′ (z) are compared in the following plot.
Matlab Assignment Help
and we note:
•The final value is incorrect (due to aliasing in the transfer function), and
•Further empirical gain adjustment is necessary to match the peak responses.
(c) With the bilinear transform
Matlab Assignment Help
0.3
0.25
0.2
0.15
0.1
0.05
0.35
The step responses of H(s) and H(z) are compared in the following plot.
bilinear
continuous
0
0 2 4 6 8 10
The frequency response of these three discrete approximations of our continuous filter, are plotted and compared
to the frequency response of the continuous filter in the next page. In general, root matching and impulse
invariant filters are approximately the same and show almost exactly the same curves.
The magnitude plot shows that below 1 Hz, all of the three filters match very well with the continuous filter.
However as the frequency increases toward the Nyquist frequency the bilinear filters deviates strongly from the
continuos filter and the two others almost follow the continuos curve.
On the other hand, in the phase plot, the bilinear filter almost exactly matches the continuos filter, while the two
others deviate strongly from the continuous filter and only match it at very low frequencies (i.e. below 0.3 Hz).
Bilinear Simulation − Step Response
0.4
Matlab Assignment Help
0
−10
−20
−30
−40
−50
−60
−70
0 0.5 1 1.5 2 2.5
Frequency (Hz)
3 3.5 4 4.5 5
Root matching
Impulse Invariant Bilinear
Continuous
80
60
40
20
0
−20
−40
−60
−80
−100
0 0.5 1 1.5 2 2.5
Frequency (Hz)
3 3.5 4 4.5 5
Root matching
Impulse Invariant Bilinear
Continuous
Problem 4:
(a) From the specifications
For a continuous filter (no pre-warping)
Phase
(degrees)
Magnitude
(dB)
Matlab Assignment Help
Therefore take N = 4.
(b) In the pre-warped analog filter the critical frequencies will be
and the order is given by
Therefore take N = 3.
(c) MATLAB gave me a lot of problems with ill-conditioning while trying to do this! I had to scale the sampling rate back –
for example by a factor of 100, to 500 samples/sec.:
Matlab Assignment Help
−0.2
−0.4
−0.6
−0.8
−1
0
1
0.8
0.6
0.4
0.2
3
Imaginary
Part
−1 −0.5 0
Real Part
0.5 1
0
−50
−100
−150
0 0.5 1 1.5 2 2.5
x 10
4
Frequency (Hz)
0
−50
−100
−150
−200
−250
−300
0 0.5 1 1.5 2 2.5
x 10
4
Frequency (Hz)
Phase
(degrees)
Magnitude
(dB)
(d) The pole-zero plot and frequency response plots are shown on the next page.
Matlab Assignment Help
Phase
(degrees)
Magnitude
(dB)
20
0
−20
−40
−60
−80
−100
−120
−140
−160
−180
−200
0 0.5 1 1.5 2 2.5
x 10
4
X: 5000
Y: −3
X: 1.5e+04 Y: −3
Frequency (Hz)
0
−100
−200
−300
−400
−500
−600
−700
0 0.5 1 1.5 2 2.5
x 10
4
Frequency (Hz)
T = 1/500;
wc1 = 2*pi*50; wc2 =
2*pi*150;
wc1_p = (2/T)*tan(wc1*T/2); wc2_p =
(2/T)*tan(wc2*T/2);
[b, a] = cheby1(3, 3, 1,’s’); %Design LP with wc=1 rad/sec
[b,a]=lp2bp(b,a,sqrt(wc1_p*wc2_p),(wc2_p-wc1_p)); %Change to BP
[bz,az] = bilinear(b, a, 500);
(e) We have to pre-warp the band limits to use them in converting the prototype continuous low pass filter (with cut-off
frequency of 1 rad/sec) to our prototype continuous band pass filter.
Matlab Assignment Help

More Related Content

PDF
A Simple Communication System Design Lab #2 with MATLAB Simulink
PDF
A Simple Communication System Design Lab #3 with MATLAB Simulink
PDF
A Simple Communication System Design Lab #4 with MATLAB Simulink
PDF
A Simple Communication System Design Lab #1 with MATLAB Simulink
PDF
Data converter modelingの参考資料1
PPTX
Fft analysis
PPTX
Pulse Modulation ppt
PPTX
Fft analysis
A Simple Communication System Design Lab #2 with MATLAB Simulink
A Simple Communication System Design Lab #3 with MATLAB Simulink
A Simple Communication System Design Lab #4 with MATLAB Simulink
A Simple Communication System Design Lab #1 with MATLAB Simulink
Data converter modelingの参考資料1
Fft analysis
Pulse Modulation ppt
Fft analysis

What's hot (19)

PDF
ECE 467 Mini project 1
PPT
Ece414 chapter3 w12
PPT
Lecture18
PDF
Frame Synchronization in Digital Communication Systems
PPTX
Digital communications
PDF
Sampling and Reconstruction of Signal using Aliasing
PPTX
Fast Fourier Transform Analysis
DOCX
LMSProjectReportFINAL
PPT
Novel RF Power Amplifier Linearization Proof-Of-Concept Bipolar Ne46134
DOCX
Ecet 345 Enthusiastic Study / snaptutorial.com
PDF
Performances des turbo codes parallèles pour un canal satellite non linéaire
PPTX
Symbol timing estimation by sachin maithani
PPTX
carrier synchronization
PPTX
Pn sequence
PDF
Reversible Digital Watermarking of Audio Wav Signal Using Additive Interpolat...
PDF
SAR_ADC__Resumo
PDF
Programmable PN Sequence Generators
PPT
Lecture 1
ECE 467 Mini project 1
Ece414 chapter3 w12
Lecture18
Frame Synchronization in Digital Communication Systems
Digital communications
Sampling and Reconstruction of Signal using Aliasing
Fast Fourier Transform Analysis
LMSProjectReportFINAL
Novel RF Power Amplifier Linearization Proof-Of-Concept Bipolar Ne46134
Ecet 345 Enthusiastic Study / snaptutorial.com
Performances des turbo codes parallèles pour un canal satellite non linéaire
Symbol timing estimation by sachin maithani
carrier synchronization
Pn sequence
Reversible Digital Watermarking of Audio Wav Signal Using Additive Interpolat...
SAR_ADC__Resumo
Programmable PN Sequence Generators
Lecture 1
Ad

Similar to Digital Signal Processing Course Help (20)

PPTX
Signal Processing Assignment Help
PPTX
Signals and Systems Assignment Help
PDF
Dsp lab manual
PDF
DSP_Lab_MAnual_-_Final_Edition.pdf
DOCX
DSP_Lab_MAnual_-_Final_Edition[1].docx
PPTX
Signal Processing Assignment Help
PDF
PDF
Titan X Research Paper
DOCX
signal and system
PPTX
Signal Processing Assignment Help
PDF
dsp.pdf
PDF
Multirate sim
PDF
orfanidis-solutions-book-2nd-edition-pdf
PDF
(Original PDF) Applied Digital Signal Processing Theory and Practice
PPTX
Matlab Assignment Help
PDF
Ff tand matlab-wanjun huang
PDF
Ff tand matlab-wanjun huang
PPTX
DSP_Filters_150505.pptx
DOC
Assignment_DSP.doc
PDF
(Original PDF) Applied Digital Signal Processing Theory and Practice
Signal Processing Assignment Help
Signals and Systems Assignment Help
Dsp lab manual
DSP_Lab_MAnual_-_Final_Edition.pdf
DSP_Lab_MAnual_-_Final_Edition[1].docx
Signal Processing Assignment Help
Titan X Research Paper
signal and system
Signal Processing Assignment Help
dsp.pdf
Multirate sim
orfanidis-solutions-book-2nd-edition-pdf
(Original PDF) Applied Digital Signal Processing Theory and Practice
Matlab Assignment Help
Ff tand matlab-wanjun huang
Ff tand matlab-wanjun huang
DSP_Filters_150505.pptx
Assignment_DSP.doc
(Original PDF) Applied Digital Signal Processing Theory and Practice
Ad

More from Matlab Assignment Experts (20)

PPTX
Digital Communication Through Biorthogonal Codes: A MATLAB Assignment Solution
PPTX
Solution to MATLAB Assignment on Signals and Systems
PPTX
🚀 Need Expert MATLAB Assignment Help? Look No Further! 📊
PPTX
Matlab Assignment Help
PPTX
Matlab Assignment Help
PPTX
Matlab Assignment Help
PPTX
MAtlab Assignment Help
PPTX
Matlab Assignment Help
PPTX
Matlab Homework Help
PPTX
MATLAB Assignment Help
PPTX
Matlab Homework Help
PPTX
Matlab Assignment Help
PPTX
Computer vision (Matlab)
PPTX
Online Matlab Assignment Help
PPTX
Modelling & Simulation Assignment Help
PPTX
Mechanical Assignment Help
PPTX
CURVE FITING ASSIGNMENT HELP
PPTX
Design and Manufacturing Homework Help
PPTX
Digital Image Processing Assignment Help
PPTX
Signals and Systems Assignment Help
Digital Communication Through Biorthogonal Codes: A MATLAB Assignment Solution
Solution to MATLAB Assignment on Signals and Systems
🚀 Need Expert MATLAB Assignment Help? Look No Further! 📊
Matlab Assignment Help
Matlab Assignment Help
Matlab Assignment Help
MAtlab Assignment Help
Matlab Assignment Help
Matlab Homework Help
MATLAB Assignment Help
Matlab Homework Help
Matlab Assignment Help
Computer vision (Matlab)
Online Matlab Assignment Help
Modelling & Simulation Assignment Help
Mechanical Assignment Help
CURVE FITING ASSIGNMENT HELP
Design and Manufacturing Homework Help
Digital Image Processing Assignment Help
Signals and Systems Assignment Help

Recently uploaded (20)

PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
master seminar digital applications in india
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Presentation on HIE in infants and its manifestations
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
RMMM.pdf make it easy to upload and study
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Pharma ospi slides which help in ospi learning
PDF
Classroom Observation Tools for Teachers
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Microbial diseases, their pathogenesis and prophylaxis
VCE English Exam - Section C Student Revision Booklet
O7-L3 Supply Chain Operations - ICLT Program
Chinmaya Tiranga quiz Grand Finale.pdf
master seminar digital applications in india
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Presentation on HIE in infants and its manifestations
2.FourierTransform-ShortQuestionswithAnswers.pdf
GDM (1) (1).pptx small presentation for students
RMMM.pdf make it easy to upload and study
Abdominal Access Techniques with Prof. Dr. R K Mishra
102 student loan defaulters named and shamed – Is someone you know on the list?
01-Introduction-to-Information-Management.pdf
Pharma ospi slides which help in ospi learning
Classroom Observation Tools for Teachers
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf

Digital Signal Processing Course Help

  • 1. Matlab Assignment Help To get more info, Please Visit : – https://www.matlabassignmentexperts.com/ E-Mail : – info@matlabassignmentexperts.com Contact Us : – +1 678 648 4277
  • 2.  F j   s c ra mb l e   F  j ( a     s c ra m bl e d sp e e c h o ri g i n a l s p e e c Thus, a spectrum as shown on the left will be translated to that shown on the right. The decoder will restore the correct frequency relationships. Consider a component A sin(Ωt), wewant to translate it to A sin ((Ωa − Ω) t). From elementary trigonometry A sin ((Ωa − Ω) t) = A (sin(Ωat) cos(Ωt) − cos(Ωat) sin(Ωt)) = A sin(Ωat) sin(Ωt + π/2) − A sin(Ωat + π/2) sin(Ωt) which leads to the following time-domain processing to shift a single frequency component. Problem 1: A Mini-project: An Audio Scrambler .Text-messaging is out-of-date! You and I have been communicating by sending voice-messages to each other as “.wav” files. It’s not that I am paranoid, but everybody is out to get me! In particular, “they” have been intercepting all of our voice messages. But we are going to outwit “them” by using MATLAB to scramble our voice messages before sending them, making them unintelligible using a secret encoding scheme, and then wewill descrambling the messages when we get them. your task is to design and implement the speech encoder and decoder. the requirement is that the scrambled message should occupy the same audio bandwidth (approximately 300 – 3000 Hz) as the original message, and the descrambled message should have good fidelity. We will use a frequency domain “mirroring” scheme, where the frequency components are flipped, so that high frequencies are translated to low frequencies and vice-versa. A spectral com ponent with frequency Ω1 will be translated to a new frequency Ωa − Ω1, where Ωa is known to the sender and recipient. The resulting waveform is unintelligible until the frequency relationships have been restored. The scheme is shown below: Signal Processing Continuous And Discrete Matlab Assignment Help
  • 3. A π/2 phase-shifter is easy to build for a single frequency, such as sin(Ωat) but when the input signal, such as a speech signal, contains more than just a single component each spectral component must be shifted by 90◦. This requires an all-pass filter with a constant phase shift, which is a difficult design task for a continuous filter. Approximations as active or passive filters are available. The Hilbert transformer is an all-pass filter with a transfer function which is exactly what wewant. The following shows the scrambler implemented with a Hilbert transformer Then G(jΩ) = F(j(Ωa − Ω). Matlab Assignment Help
  • 4. (a) Practical implementations of Hilbert transformers are approximations. For example, suppose an implementation has ripple in its passband so that at a particular frequency Ωo the transfer function is π where δ is a perturbation from the ideal response. Find the output g(t) when the input is f (t) = A sin(Ωot). Have any “spurious” spectral components been introduced? (You can do this with simple trigonometric identities.) (b) Your task is to design, implement, and test an audio scrambler and descrambler using this encoding technique: •You should write a pair of MATLAB functions as follows: y_scramble = encode(f_audio, Fs, Fa) y_descramble = decode(y_scramble, Fs, Fa) where f audio is a MATLAB array containing the audio file to be processed, Fs is the sampling frequency (Hz) of the data in f audio, and Fa is the frequency (Hz) around which the spectrum is reflected. The first function should take encode the file, the second restore the scrambled version to the original. •We will supply you with two audio files (.wav) that you can download and use. One is an ordinary audio file (PS8Raw.wav) that is to be to be scrambled and descrambled. The second is one that we have already scrambled (PS8Scrambled.wav). These may be imported into your MATLAB workspace using the wavread() function [f_audio,Fs,Nbits] = wavread(’myfile’) see the MATLAB help. •You should use the Parks-McClellan design function firpm() to design a Hilbert trans former that covers the frequency span 300 – 3000 Hz. (The help on firpm() has an example) Be aware that the quality of you scrambling will be affected by the pass-band ripple that you allow. Matlab Assignment Help
  • 5. •Don’t forget that the FIR Hilbert transformer is a causal linear-phase system, and that it MUST have an odd length impulse response. You will need to add an equivalent delay filter in the other arm. Design an appropriate FIR impulse response. •The audio arrays will be large. Use ff t f i l t () to do the actual filtering operations. •Let’s standardize on a reflection frequency Fa = 3500Hz. •To test your scrambler, load the audio file, then compute and plot its magnitude spec trum. Then scramble the file and plot its magnitude spectrum. Make sure it is what you expect. If there are any spurious components, try to find why they are there, and fix them. You should submit the following: (a)Listings of your two functions. (b) Details of your Hilbert transformer design, including plots of the pass-band ripple, and details of the phase response. (c)A summary of your approach, including the compromises you made in any design choices. (d)Plots of the magnitude spectra of 1.The audio file in PS8Raw.wav. 2.Your scrambled version of PS8Raw.wav. Matlab Assignment Help
  • 6. 3. The result of descrambling your scrambled version of PS8Raw.wav. Use fftshift() on the spectra to make them more readable. (e)You should upload three .wav files to the 2.161 MIT Server site in the homework section: 1.Your scrambled version of PS8Scrambled.wav. 2.Your descrambled version of PS8RawScrambled.wav. 3.The result of scrambling then descrambling PS8Raw.wav. Be sure to name the files so that they are clearly identified as yours... We will be available to help if you run into trouble. Problem 2: An analog integrator has a transfer function H(s) = 1/s. Use the bilinear transform to find (a) the discrete time transfer function H(z), and (b) the difference equation for this form of digital integrator. Plot the frequency response functions of the resulting digital integrator. Problem 3: A continuous band-pass filter is described by the transfer function Derive a recursive computing formula (difference equation) for (1) a step-invariant, (2) a root matching, and (c) a bilinear transform digital filter based on this system. Assume ΔT = 0.1s. Problem 4: A digital filter is to be designed to the following specifications: Matlab Assignment Help
  • 7. . (a)What is the order of the continuous filter if a Chebyshev design is used. (b) Prewarp the critical frequencies to find the equivalent frequencies for use in the bilinear trans form with a sampling frequency of 50,000 samples/sec. (c) Use MATLAB to design a continuous Chebyshev Type 1 filter with the prewarped crical frequencies. Then use the bilinear() function to compute the discrete time transfer function from the continuous prototype. (d)Make frequency response and pole-zero plots for your resulting filter. (e)Use MATLAB to convert the prototype design to a band-pass digital filter with a passband of 5-15 kHz. Matlab Assignment Help
  • 8. Problem 1: The standard Hilbert transformer is defined as: MATLAB uses the same definition and this can be verified by finding the phase of ω → 0+. The implemented filter’s phase has a linear component added to the −π/2 value (for ω> 0). Our filter has −π/2 phase shift and this corresponds to: A sin ((Ωa −Ω) t) = A (sin(Ωat) cos(Ωt) −cos(Ωat) sin(Ωt)) = −A sin(Ωat) sin(Ωt −π/2) −A cos(Ωat) sin(Ωt) We have to be careful in implementing the scrambler. The scrambler diagram corresponds to the below figure. However, note that the audio play is not affected by sign of output (i.e. a signal is played the same as its negative version). (a) The delay in implementation does not affect this discussion. So we ignore it for this analysis. We consider a sinusoidal component of input as f(t) = sin(Ωot). The output of filter would be |H(jΩo)|sin(Ωot+6 H(jΩo)) = (1+δ)sin(Ωot− π 2 ). We follow this through above diagram to compute g(t): Matlab Assignment Help Solutions
  • 9. As a result due to practical implementation, some “spurious” components are introduced at Ωa + Ωo. The original signal has a (desired) audio frequency content of Ωo = 300 − 3000 Hz. In the beginning, we can pre- process the audio file with a band-pass filter passing 300 − 3000 Hz contents and then follow it with the scrambling process. We use a Hilbert transformer with a pass-band equal to 300 to (Fs/2 − 300) Hz, where Fs is the sampling frequency . The extended pass-band of the filter, is because a high-order (low-ripple) “firpm-built” Hilbert filter requires a symmetric pass-band (see MATLAB doc umentation). After passing the audio file through our transformer with Ωa = 3500 Hz, the output will have a large (desired) spectrum content at 500 − 3200 Hz and a spurious content at 3800 −6500 Hz (which could be folded to some lower frequency). If δ is not small enough, we might wish to post-process the filter output with a pass-band filter passing 500 − 3200 Hz contents and then save it as scrambled signal. This post processing step of scrambling, can be considered as a pre-processing step of desrcambling procedure. Theoretically, descrambling is the same as scramblibg. However, the practical realization of the Hilbert filter is bandwidth limited (while the ideal Hilbert filter is an all-pass filter). The Hilbert Filter for desrcambling, requires a pass-band equal to 500 to (Fs/2 − 500) Hz. However, if we pre-process the srcambled signal with a pass-band filter passing 500 − 3200 Hz contents, then we can use the same Hilbert filter for scrambling and descrambling. The output of desrcambling can be further post-processed with a pass-band filter passing audio contents (300 −300 Hz). Matlab Assignment Help
  • 10. (b) This is not the complete solution to all parts of the problem. This simply serves to show the approach. To study the full solution start with attached Main.m file and follow other scripts. Note that the encoding and decoding functions can be identical (if we use proper pre/post filters). Here is the encoding script: function fout = encode(fin,Fs,Fc) %%Design the Hilber transformer % Note: firpm() seems to need the band edges to be symmetric about 0.5 h1=firpm(150,[300*2/Fs 1-300*2/Fs],[1 1 ],’Hilbert ’); %h1=firpm(150,[500*2/Fs 1-500*2/Fs],[1 1 ],’Hilbert ’); %change in the decode file y1=fftfilt(h1,fin); %%Delay: Approach 1 N=length(h1); %Nis odd y2=zeros(size(fin));y2((N-1)/2+1:end)=fin(1:end-(N-1)/2); %% Delay: Design the delay filter, Approach 2 %h2 = zeros(1,length(h1)); %h2((N-1)/2+1) = 1; %Filter the data %y2=fftfilt(h2,fin); %%Filter Output t=(0:length(fin)-1)*(1/Fs); y3=-y1.*sin(2*pi*Fc*t’); y4=-y2.*cos(2*pi*Fc*t’); fout= y3+y4; The following graph shows one the encoder’s Hilbert transformer (order 150). Matlab Assignment Help
  • 11. Encoder Hilbert Filter for F =11.025 KHz s 5 0 −5 −10 −15 −20 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Magnitu de (dB) Normalized Frequency ( rad/sample) 0 Phase ( degrees ) −5000 −10000 −15000 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 Normalized Frequency ( rad/sample) 0.8 0.9 1 We passed the input original audio through a band-pass filter (300-3000 Hz) to minimize the folding of high frequencies. We used the same filter for the decoder output. We also used a band pass filter (500-3200 Hz) for the encoder output or for the decoder input. These pass-band filters are implemented as a series of low and high pass filters (all order 200). Otherwise, we could not build a nice pass band filter in a single step. All these filters are shown on the next page Note that following the original signal through all filters (audio filter, Hilbert, pre-decode, Hilbert and audio filter), results in a delay equal to 750 samples ( 3 ∗(200/2 + 200/2) + 2 ∗(150/2) ). Although 750 might be a large number, but even for our lowest Fs = 11.02 KHz, this means less then 0.07 second delay. This small delay is hardly noticeable by our hearing system and hence our filter’s orders are not too large. Matlab Assignment Help
  • 12. Audio Filter (Post−Decoding or Pre−Encoding) 20 0 −20 −40 −60 −80 −100 −120 −140 Magnitu de (dB) Magnitu de (dB) −160 0 Low Pass: Fs=11.025 KHz High Pass: Fs=11.025 KHz Low Pass: Fs=22.05 KHz High Pass: Fs=22.05 KHz 2000 4000 6000 Frequency (Hz) 8000 10000 Post−Encoding (Pre−Decoding) Filter 20 0 −20 −40 −60 −80 −100 −120 −140 −160 0 2000 4000 Low Pass: Fs=11.025 KHz High Pass: Fs=11.025 KHz Low Pass: Fs=22.05 KHz High Pass: Fs=22.05 KHz 8000 10000 6000 Frequency (Hz) The following plots resulted from working on PS8Raw.wav: Matlab Assignment Help
  • 14. (3): Magnitude Spectrum of Encoder Output 4500 4000 3500 3000 2500 2000 1500 1000 500 0 −5000 −4000 −3000 −2000 −1000 0 1000 2000 3000 4000 5000 Frequency (Hz) (4): 4000 3500 3000 2500 2000 1500 1000 500 0 −5000 −4000 −3000 −2000 −1000 0 1000 2000 3000 4000 5000 Frequency (Hz) Magnitude Spectrum of Decoder Input (After Decoder Fitler) 4500 Matlab Assignment Help
  • 15. (5): Magnitude Spectrum of Decoder Output 0 1000 2000 3000 4000 5000 0 −5000 −4000 −3000 −2000 −1000 4500 4000 3500 3000 2500 2000 1500 1000 500 Frequency (Hz) (6): Magnitude Spectrum of Audio Fitered Decoder Output 0 1000 2000 3000 4000 5000 0 −5000 −4000 −3000 −2000 −1000 4500 4000 3500 3000 2500 2000 1500 1000 500 Frequency (Hz) Comparing the input and decoded spectra shows them to be the same. In your solutions, we will be looking for stray spectral components that may result from ripple in your Hilbert transformer response etc. (4): Magnitude Spectrum of Decoder Input (After Decoder Fitler) Matlab Assignment Help
  • 16. Problem 2: (a) If H(s) = 1/s, then the bilinear transform (using Tustin’s approximation) gives: (b) From above which is the trapezoidal numerical integration rule. The following MATLAB commands generate the frequency response: b = [0.5 0.5]; a = [1 -1]; freqz(b,a) title(’Bilinear Integrator’) Matlab Assignment Help
  • 17. Note that while the phase is constant at −π/2, the magnitude plot does not show a constant slope of -20 dB/decade as does the analog integrator. Problem 3: (a) The plant has (1) a zero at s = 0, and (2) a pair of coincident poles at s = −1. The root-matching (matched z-transform) discrete-time system is and with T = 0.1 sec., Matlab Assignment Help
  • 18. To create a minimum delay filter, make the order of the numerator and denominator equal by adding a zero at the origin: The gain factor K must be determined empirically. This is normally done using the finalvalue theorem, but in this case lims→0 H(s) = 0 and the final values cannot be compared. Some other amplitude criterion must be used; in this case the peak value of the two step responses were compared and found to be 0.367 for the continuous system H(s) and 4.018 for the discrete system H(z). Then K = 0.367/4.018 = 0.0913. Alternatively you might compare the response of the analog system to a ramp input r(t) = t with the analogous discrete response to a ramp rn = 0.1n and use their final values to match the gains resulting in K = 0.097. The step responses with K = 0.0913 are compared in the plot below Matlab Assignment Help
  • 19. Note the slight delay in the digital response. (b) The system has repeated poles at s = −1. Then H(s) may be expressed in partial fractions as and As we discussed in class, this form of impulse invariant simulation suffers from a gain error, and a correction is more frequently used. The step responses of H(s) and H ′ (z) are compared in the following plot. Matlab Assignment Help
  • 20. and we note: •The final value is incorrect (due to aliasing in the transfer function), and •Further empirical gain adjustment is necessary to match the peak responses. (c) With the bilinear transform Matlab Assignment Help
  • 21. 0.3 0.25 0.2 0.15 0.1 0.05 0.35 The step responses of H(s) and H(z) are compared in the following plot. bilinear continuous 0 0 2 4 6 8 10 The frequency response of these three discrete approximations of our continuous filter, are plotted and compared to the frequency response of the continuous filter in the next page. In general, root matching and impulse invariant filters are approximately the same and show almost exactly the same curves. The magnitude plot shows that below 1 Hz, all of the three filters match very well with the continuous filter. However as the frequency increases toward the Nyquist frequency the bilinear filters deviates strongly from the continuos filter and the two others almost follow the continuos curve. On the other hand, in the phase plot, the bilinear filter almost exactly matches the continuos filter, while the two others deviate strongly from the continuous filter and only match it at very low frequencies (i.e. below 0.3 Hz). Bilinear Simulation − Step Response 0.4 Matlab Assignment Help
  • 22. 0 −10 −20 −30 −40 −50 −60 −70 0 0.5 1 1.5 2 2.5 Frequency (Hz) 3 3.5 4 4.5 5 Root matching Impulse Invariant Bilinear Continuous 80 60 40 20 0 −20 −40 −60 −80 −100 0 0.5 1 1.5 2 2.5 Frequency (Hz) 3 3.5 4 4.5 5 Root matching Impulse Invariant Bilinear Continuous Problem 4: (a) From the specifications For a continuous filter (no pre-warping) Phase (degrees) Magnitude (dB) Matlab Assignment Help
  • 23. Therefore take N = 4. (b) In the pre-warped analog filter the critical frequencies will be and the order is given by Therefore take N = 3. (c) MATLAB gave me a lot of problems with ill-conditioning while trying to do this! I had to scale the sampling rate back – for example by a factor of 100, to 500 samples/sec.: Matlab Assignment Help
  • 24. −0.2 −0.4 −0.6 −0.8 −1 0 1 0.8 0.6 0.4 0.2 3 Imaginary Part −1 −0.5 0 Real Part 0.5 1 0 −50 −100 −150 0 0.5 1 1.5 2 2.5 x 10 4 Frequency (Hz) 0 −50 −100 −150 −200 −250 −300 0 0.5 1 1.5 2 2.5 x 10 4 Frequency (Hz) Phase (degrees) Magnitude (dB) (d) The pole-zero plot and frequency response plots are shown on the next page. Matlab Assignment Help
  • 25. Phase (degrees) Magnitude (dB) 20 0 −20 −40 −60 −80 −100 −120 −140 −160 −180 −200 0 0.5 1 1.5 2 2.5 x 10 4 X: 5000 Y: −3 X: 1.5e+04 Y: −3 Frequency (Hz) 0 −100 −200 −300 −400 −500 −600 −700 0 0.5 1 1.5 2 2.5 x 10 4 Frequency (Hz) T = 1/500; wc1 = 2*pi*50; wc2 = 2*pi*150; wc1_p = (2/T)*tan(wc1*T/2); wc2_p = (2/T)*tan(wc2*T/2); [b, a] = cheby1(3, 3, 1,’s’); %Design LP with wc=1 rad/sec [b,a]=lp2bp(b,a,sqrt(wc1_p*wc2_p),(wc2_p-wc1_p)); %Change to BP [bz,az] = bilinear(b, a, 500); (e) We have to pre-warp the band limits to use them in converting the prototype continuous low pass filter (with cut-off frequency of 1 rad/sec) to our prototype continuous band pass filter. Matlab Assignment Help