Matrix dimensions must agree

4 visualizaciones (últimos 30 días)
Oscar Francisco Barba Toscano
Oscar Francisco Barba Toscano el 23 de Oct. de 2022
¡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);

Respuesta aceptada

Walter Roberson
Walter Roberson el 23 de Oct. de 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 comentario
Oscar Francisco Barba Toscano
Oscar Francisco Barba Toscano el 28 de Oct. de 2022
Thanks for the help of the explanation. It helped me also to solve a further problem.
¡Really appreciate your answer!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by