ht2383_matlab_HW9_report
pdf
keyboard_arrow_up
School
New York University *
*We aren’t endorsed by this school
Course
6113
Subject
Electrical Engineering
Date
Feb 20, 2024
Type
Pages
12
Uploaded by BarristerBoulderNarwhal28
I create a MATLAB file call problem.m I put my code in there. In the 'mtlab.wav'
, I heard a clean sound with short fast pronounced ‘matlab’.
In the 'mtlab_noisy.wav'
I heard a short pronounced ‘matlab’ with a shrill whistle.
[Y_clean, Fs_clean] = audioread(
'mtlab.wav'
); [Y_noisy, Fs_noisy] = audioread(
'mtlab_noisy.wav'
); soundsc(Y_clean, Fs_clean); soundsc(Y_noisy, Fs_noisy); As following impulse plot, we can clearly find that noise located at -1 to -0.8 and 0.8 to 1.
fx = fft(Y_clean,7418); fy = fft(Y_noisy,7418); n = [-1:1/3709:1]; n = n(1:end-1);
R = 512; window = hamming(R); N = 512; L = 25; overlap = R - L; fs = Fs_clean; figure subplot(2,1,1) plot(n,abs(fftshift(fx))) title(
'original signal'
) subplot(2,1,2) plot(n,abs(fftshift(fy))) title(
'signal with noise'
) From the spectrogram you can tell noisy one has noticeable noise around 3kHz and above.
Clean vs noisy:
figure; subplot(2, 1, 1); spectrogram(Y_clean, window, overlap, N, fs, 'yaxis'
); title(
'Clean Signal Spectrogram'
); subplot(2, 1, 2); spectrogram(Y_noisy, window, overlap, N, fs, 'yaxis'
); title(
'Noisy Signal Spectrogram'
); Option A:
W as constant:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
I set w=10 and w=50 for weight function turned to emphasize noise removal and allow a transition bank, and the following are the impulse and spectrogram result.
W=10:
W=50:
Option B:
I set short as 10, long as 40:
h_short = firpm(10, [0 fp fs 0.5]*2, [1 1 0 0], W1); h_long = firpm(40, [0 fp fs 0.5]*2, [1 1 0 0], W1); the following are the impulse response and spectrogram of different length under the same weighting function:
From the spectrogram we can tell short one still has some noise remaining, but longer one is cleaner.
Option C:
The following is the n=100 Impulse Response for Weight Function and spectrogram for Weight Function:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
From the plot we can observe that when n=100 it basically filters out 80% of the spectrogram, which is not the ideal result we want.
The following is the n=20 Impulse Response for Weight Function and spectrogram for Weight Function:
From the plot we can observe that when n=20, the result of the filter is still not very well.
In summary, after comparing all 3 options personally I prefer option b with long filter length, for me it sound better and the process is quite straight forward. For option a and c the effect the filter doesn’t perfectly filter out the noise very well.
Code:
[Y_clean, Fs_clean] = audioread(
'mtlab.wav'
); [Y_noisy, Fs_noisy] = audioread(
'mtlab_noisy.wav'
); soundsc(Y_clean, Fs_clean); soundsc(Y_noisy, Fs_noisy);
fx = fft(Y_clean,7418); fy = fft(Y_noisy,7418); n = [-1:1/3709:1]; n = n(1:end-1); R = 512; window = hamming(R); N = 512; L = 25; overlap = R - L; fs = Fs_clean; figure subplot(2,1,1) plot(n,abs(fftshift(fx))) title(
'original signal'
) subplot(2,1,2) plot(n,abs(fftshift(fy))) title(
'signal with noise'
) figure; subplot(2, 1, 1); spectrogram(Y_clean, window, overlap, N, fs, 'yaxis'
); title(
'Clean Signal Spectrogram'
); subplot(2, 1, 2); spectrogram(Y_noisy, window, overlap, N, fs, 'yaxis'
); title(
'Noisy Signal Spectrogram'
); % Option A - Fixed Filter Length with Different Weights fp = 0.4044; fs = 0.4244; W_constant = [1 1]; % Constant weight over entire frequency range h_constant = firpm(25, [0 fp fs 0.5]*2, [1 1 0 0], W_constant); % Option A - Weight Function for Noise Removal and Transition Bank
W_emphasized1 = [1 10]; W_emphasized2 = [1 50]; h_emphasized1 = firpm(25, [0 fp fs 0.5]*2, [1 1 0 0], W_emphasized1); h_emphasized2 = firpm(25, [0 fp fs 0.5]*2, [1 1 0 0], W_emphasized2); % Visualize the results figure; % Impulse Response for Constant Weight subplot(2, 1, 1); stem(0:length(h_constant)-1, h_constant, 'filled'
); title(
'Filter with Constant Weight - Impulse Response'
); % Spectrogram for Constant Weight subplot(2, 1, 2); spectrogram(filter(h_constant, 1, Y_noisy), window, overlap, N, fs, 'yaxis'
); title(
'Noisy Signal Spectrogram (Constant Weight)'
); figure; % Impulse Response for Weight Function subplot(2, 1, 1); stem(0:length(h_emphasized1)-1, h_emphasized1, 'filled'
); title(
'Filter with Emphasized Noise Removal w=10 - Impulse Response'
); % Spectrogram for Weight Function subplot(2, 1, 2); spectrogram(filter(h_emphasized1, 1, Y_noisy), window, overlap, N, fs, 'yaxis'
); title(
'Noisy Signal Spectrogram (Emphasized Noise Removal)'
); figure; % Impulse Response for Weight Function subplot(2, 1, 1); stem(0:length(h_emphasized2)-1, h_emphasized2, 'filled'
); title(
'Filter with Emphasized Noise Removal w=50 - Impulse Response'
);
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
% Spectrogram for Weight Function subplot(2, 1, 2); spectrogram(filter(h_emphasized2, 1, Y_noisy), window, overlap, N, fs, 'yaxis'
); title(
'Noisy Signal Spectrogram (Emphasized Noise Removal)'
); % Option B - Different Filter Lengths with the Same Weight h_short = firpm(10, [0 fp fs 0.5]*2, [1 1 0 0], W1); h_long = firpm(40, [0 fp fs 0.5]*2, [1 1 0 0], W1); % Generate spectrograms for short and long filter lengths [B_short, f_short, t_short] = specgram(filter(h_short, 1, Y2), N, fs, window, overlap); [B_long, f_long, t_long] = specgram(filter(h_long, 1, Y2), N, fs, window, overlap); % Plot impulse responses figure; subplot(2, 1, 1); stem(0:length(h_short)-1, h_short, 'filled'
); title(
'Impulse Response - Short Filter Length'
); subplot(2, 1, 2); stem(0:length(h_long)-1, h_long, 'filled'
); title(
'Impulse Response - Long Filter Length'
); % Plot spectrograms figure; subplot(2, 1, 1); imagesc(t_short, f_short, log10(abs(B_short))); axis xy
; xlabel(
'Time'
); ylabel(
'Frequency'
); title(
'Spectrogram - Short Filter Length'
);
subplot(2, 1, 2); imagesc(t_long, f_long, log10(abs(B_long))); axis xy
; xlabel(
'Time'
); ylabel(
'Frequency'
); title(
'Spectrogram - Long Filter Length'
); % Option C - Use firls to Determine Filter Coefficients dev = 0.01; % Maximum deviation (1% of passband gain) % Use firpmord to determine desired filter length and weighting function [n, fo, ao, w] = firpmord([fp fs], [1 0], [dev dev*10], Fs_noisy); % Reduce the filter order (you may adjust this value) n = 20; % n=100; % Design the filter using firls b = firls(n, fo, ao, w); figure; % Impulse Response for Weight Function subplot(2, 1, 1); impz(b); title(
'Filter Designed with firls - Impulse Response'
); % Spectrogram for Weight Function subplot(2, 1, 2); [B_c, f_c, t_c] = specgram(filter(b, 1, Y_noisy), N, fs, window, overlap); imagesc(t_c, f_c, log10(abs(B_c))); axis xy
; xlabel(
'Time'
); ylabel(
'Frequency'
); title(
'Spectrogram - firls Designed Filter'
);
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Documents
Related Questions
We want to design a digital circuit that converts
Gray code (ABC) to Binary code (xyz). Set up a 8-to-
1 line multiplexer so that the output gives y as a
function of ABC. "A" is given to the most significant
bit of the control inputs of the multiplexer. "C" is
given to the least significant bit of the control inputs
of the multiplexer.
arrow_forward
What are the shortcomings of one dimensional parity error detection scheme? And discuss the advantages of Two-dimensional parity over single parity scheme?
arrow_forward
Perform the following functions:a. What will be the parity of the data signal to send as even parity:10100111001b. (0101)BCD = (---?---)2 = (---?---)Excess-3 = (---?---)Grayc. How to represent following numbers in signed representation:1. (-78)102. (-19)10
arrow_forward
Suppose that the circuit shown in the below figure is to be modeled. What is the
correct VHDL option for the synthesis of this circuit?
global_resetb
zb-
global cik
a
arrow_forward
Given that the base address is FoH.
1. Create a new asm project “Lab2_Q1.asm". Assume that port A of 8255A PPI is
connected to 8085. Write assembly code to send the value of FFH to FoH. Enter a delay
of 2 ms for each transmission.
arrow_forward
Choose the correct answer
low HDOP (Horizontal Dilution of Precision) number such as2 indicates a ...........................
a.poor fix
b.good fix
c.poor signal quality
d. good signal quality
arrow_forward
3. Some GPS receivers use 1 bit ADCS (Analog-to-digital Converters) to sample and quantize the
signal i.e. the output of the ADC is simply 2 quantization levels: -1 or +1. This is typically done
to save on power.
(a) What is the quantization SNR? How does it compare to typical thermal noise SNR of a GPS
signal before correlating with the CDMA code?
(b) Justify, how come it is possible to sample the signal using a single bit and still get good
performance.
arrow_forward
Explain the functions of decoders and multiplexers. Then given at least two examples of applications for both of them.
arrow_forward
No paper
arrow_forward
During the execution of an IN instruction, the WR* signal will ________.
A) Stay high.
B) Go low.
C) Tristate.
D) Multiplex
arrow_forward
Design a combinational circuit with the four inputs A,B.C, and D, and three outputs
X, Y, and Z. When the binary input is odd number, the binary output is one lesser
than the input. When the binary input is even number the binary output is one greate
than the input. Implement the function using multiplexers with minimal input and
select line.
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you

Electricity for Refrigeration, Heating, and Air C...
Mechanical Engineering
ISBN:9781337399128
Author:Russell E. Smith
Publisher:Cengage Learning

Delmar's Standard Textbook Of Electricity
Electrical Engineering
ISBN:9781337900348
Author:Stephen L. Herman
Publisher:Cengage Learning
Related Questions
- We want to design a digital circuit that converts Gray code (ABC) to Binary code (xyz). Set up a 8-to- 1 line multiplexer so that the output gives y as a function of ABC. "A" is given to the most significant bit of the control inputs of the multiplexer. "C" is given to the least significant bit of the control inputs of the multiplexer.arrow_forwardWhat are the shortcomings of one dimensional parity error detection scheme? And discuss the advantages of Two-dimensional parity over single parity scheme?arrow_forwardPerform the following functions:a. What will be the parity of the data signal to send as even parity:10100111001b. (0101)BCD = (---?---)2 = (---?---)Excess-3 = (---?---)Grayc. How to represent following numbers in signed representation:1. (-78)102. (-19)10arrow_forward
- Suppose that the circuit shown in the below figure is to be modeled. What is the correct VHDL option for the synthesis of this circuit? global_resetb zb- global cik aarrow_forwardGiven that the base address is FoH. 1. Create a new asm project “Lab2_Q1.asm". Assume that port A of 8255A PPI is connected to 8085. Write assembly code to send the value of FFH to FoH. Enter a delay of 2 ms for each transmission.arrow_forwardChoose the correct answer low HDOP (Horizontal Dilution of Precision) number such as2 indicates a ........................... a.poor fix b.good fix c.poor signal quality d. good signal qualityarrow_forward
- 3. Some GPS receivers use 1 bit ADCS (Analog-to-digital Converters) to sample and quantize the signal i.e. the output of the ADC is simply 2 quantization levels: -1 or +1. This is typically done to save on power. (a) What is the quantization SNR? How does it compare to typical thermal noise SNR of a GPS signal before correlating with the CDMA code? (b) Justify, how come it is possible to sample the signal using a single bit and still get good performance.arrow_forwardExplain the functions of decoders and multiplexers. Then given at least two examples of applications for both of them.arrow_forwardNo paperarrow_forward
- During the execution of an IN instruction, the WR* signal will ________. A) Stay high. B) Go low. C) Tristate. D) Multiplexarrow_forwardDesign a combinational circuit with the four inputs A,B.C, and D, and three outputs X, Y, and Z. When the binary input is odd number, the binary output is one lesser than the input. When the binary input is even number the binary output is one greate than the input. Implement the function using multiplexers with minimal input and select line.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Electricity for Refrigeration, Heating, and Air C...Mechanical EngineeringISBN:9781337399128Author:Russell E. SmithPublisher:Cengage LearningDelmar's Standard Textbook Of ElectricityElectrical EngineeringISBN:9781337900348Author:Stephen L. HermanPublisher:Cengage Learning

Electricity for Refrigeration, Heating, and Air C...
Mechanical Engineering
ISBN:9781337399128
Author:Russell E. Smith
Publisher:Cengage Learning

Delmar's Standard Textbook Of Electricity
Electrical Engineering
ISBN:9781337900348
Author:Stephen L. Herman
Publisher:Cengage Learning