argument should be a vector

10 views (last 30 days)
Razan Al Hakim
Razan Al Hakim on 28 Nov 2021
Commented: Razan Al Hakim on 28 Nov 2021
figure(1)
subplot (5,1,1)
suspect1=audioread('Bashar.wav'); %importing audio
audiolength1=length(suspect1) %length of audio
[x1,fs1]=audioread('Bashar.wav'); %vector, fs
xFFT1=fft(x1);
f1=-fs1/2:fs1/length(x1):fs1/2-fs1/length(x1);
plot (f1, fftshift(abs(xFFT1)))
noiseAmplitude=0.09;
Noisy_thiefAudio= x2 + noiseAmplitude*rand(audiolength2,1)-noiseAmplitude/2;
noisylength=length(Noisy_thiefAudio)
subplot(5,1,5);
plot(x2,'r-');
WHENEVER I TRY TO CORRELATE, THE ERROR IS "Error using matlab.internal.math.parseXcorrOptions (line 71)
%%%Second argument must be a vector.
%%%Error in xcorr (line 72)
%%% matlab.internal.math.parseXcorrOptions(varargin{:});
I know my Noisy_thiefAudio should be a vector but im not finding a way to convert it. Help please
  3 Comments
Walter Roberson
Walter Roberson on 28 Nov 2021
Noisy_thiefAudio= x2 + noiseAmplitude*rand(audiolength2,1)-noiseAmplitude/2;
x2 is not defined. audiolength2 is not defined.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 28 Nov 2021
I suspect that your x2 is the output of an audioread(), and that your audio file has two channels (stereo). Your code is expecting that your .wav files only have one channel (mono)
  2 Comments
Razan Al Hakim
Razan Al Hakim on 28 Nov 2021
I messed up in the correlation part. My goal is to correlate the noisy signal with each of the previous 4 signals. Can you help with this?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!