Matrix dimensions error for adding noise vectors
Show older comments
I've got some code for my adding my noise vectors to my pwelch command, but my matrix dimensions ar not agreeing in my new_sound_array variable. I cannot change the frequencies or amplitudes of x1 and x2, as those need to stay the same. Can someone help me with this?
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:1;
t1=t(1,1:5189);
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+x1;
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);
Accepted Answer
More Answers (0)
Categories
Find more on Spectral Estimation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!