Matrix dimensions must agree

9 vues (au cours des 30 derniers jours)
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);

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by