Matrix dimensions must agree

5 Ansichten (letzte 30 Tage)
Oscar Francisco Barba Toscano
¡Greetings to everyone!
I am trying to make a project of mixing an audio signal with an echoed white noise signal, but have the "Inner Matrix Dimensions Must Agree" at the moment of getting the transfer function.
I am gently asking for assistance.
Thank you all in advance.
The shown error is the following:
Error using / Matrix dimensions must agree.
Error in RuidoBlanco (line 24) H = eco_f/ruido_f;
And here is my code:
fs = 48000;
tSpan = 10;
t = 0:1/fs:tSpan-1/fs;
sam = size(t,2);
mu = 0;
sigma2 = 0.1;
dst = sqrt(sigma2);
var_dB = 10*log(sigma2);
X = dst*randn(sam,1)+mu;
ruido = int16(X/max(abs(X))*2^15-1);
archivo = 'RuidoBlanco.wav';
audiowrite(archivo, ruido, fs);
[ruidoeco, feco] = audioread('ruido_eco.wav');
[audio, faud] = audioread('audio.wav');
audio_f = abs(fft(audio));
ruido_f = abs(fft(ruido));
eco_f = abs(fft(ruidoeco));
H = eco_f/ruido_f;
audioeco = conv(H, audio_f);
audio_eco = ifft(audioeco);
audiofi = int16(audio_eco/max(abs(audio_eco))*2^15-1);
archivo = 'Final.wav';
audiowrite(archivo, audiofi, fs);

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 23 Okt. 2022
The operator A/B is roughly A * pinv(B) where * is "inner product" (matrix multiplication). But / has more restrictions than that summary would suggest.
If you want to divide corresponding elements of two vectors or arrays then use the division operator which is ./ not /
  1 Kommentar
Oscar Francisco Barba Toscano
Thanks for the help of the explanation. It helped me also to solve a further problem.
¡Really appreciate your answer!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by