Matrix dimensions must agree
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Oscar Francisco Barba Toscano
am 23 Okt. 2022
Kommentiert: Oscar Francisco Barba Toscano
am 28 Okt. 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);
0 Kommentare
Akzeptierte Antwort
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 /
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!