Need to find dominant frequencies, as well as peaks corresponding to noise and amplitude
4 views (last 30 days)
Show older comments
Nathan Jaqua
on 30 Sep 2019
Answered: Mahesh Taparia
on 3 Oct 2019
Hi, I have 3 things I need to find -
- What are the two prominent frequencies in the doorbell file? __________ and ______________
2. At what frequencies you see peaks corresponding to noise in spectrum? _____________ and ________________. Their amplitudes are ___________ and _____________
3.Plot the convolved spectrum. The new amplitude values of the noise are__________________________ and _________________.
I know I need to do 1 at y_spectrum, 2 at new_sound_array, and 3 at pwelch(Final_new_array). How do I do this with MATLAB?
clc;
close all;
clear all;
[y,Fs]=audioread('doorbell.wav');%reading audio file
y=y';
y_spectrum=pwelch(y);
sound(y_spectrum);%playing the spectrum using sound function
%% creating noise vectors
t=0:1/Fs:2;
t1=t(1,1:33292);
f1=4000;
a1=0.2;
x1=a1*sin(2*pi*f1*t1);
f2=5000;
a2=0.25;
x2=a2*sin(2*pi*f2*t1);
%% adding noise vectors to sound array
new_sound_array=y+x1+x2;
sound(new_sound_array,Fs);
new_sound_array_spectrum=pwelch(new_sound_array);
sound(new_sound_array_spectrum);
%%convolution of H array with new_sound_array
H=[0.0065 0.0103 0.0210 0.0382 0.0599 0.089 0.1032 0.1171 0.1221 0.1171 0.1032 0.0829 0.0599 0.0382 0.0210 0.0103 0.0065];
Final_new_array=conv(new_sound_array,H);
Final_new_array_spectrum=pwelch(Final_new_array);
sound(Final_new_array_spectrum);
0 Comments
Accepted Answer
Mahesh Taparia
on 3 Oct 2019
Hi,
The prominent frequency and amplitude can be estimated by plotting the power spectral density of the required signal. Since the signal which you have provided consists of some finite number of peaks, you can take the data tip cursor at the peaks in the respective plot and find the (x,y) coordinate. The abscissa will correspond to frequency of the signal and ordinate corresponds to amplitude. Adding the following code may help you:
figure;plot(y_spectrum) %plotting the spectrum
figure;plot(new_sound_array_spectrum) %ploting the spectrum with noise
figure;plot(Final_new_array_spectrum) %plotting convolved signal
0 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!