Borrar filtros
Borrar filtros

Why my calculation result is not matrix result?

2 visualizaciones (últimos 30 días)
ZHU z
ZHU z el 10 de Abr. de 2022
Comentada: ZHU z el 13 de Abr. de 2022
The result of my matla calculation is a numerical value instead of a matrix result, so I can't draw the relevant graph(figure3):
——The output of AweightedSPL and SPL is a numerical rather than a matrix result,So I can't plot the "frequency-AweightedSPL "spectrum. Input audio has been uploaded
can someone help me see where the code can go wrong?How should I change it?
thanks~
[x,fs] = audioread('123.wav');
L = length(x);
y=fft(x);
f =fs/2.*linspace(0,1,L/2+1);
y = y(1:L/2+1);
plot(f,abs(y),'b');
A= filterA(f);
yweighted = A'.*y;
figure(1);
plot(f,abs(yweighted),'r');
xweighted = ifft(yweighted);
xweighted = real(xweighted);
tempdata = xweighted;
tempL = length(tempdata);
temp1 = fft(tempdata)/tempL*2;
figure(2);
plot(f,abs(temp1),'g');
linelevel =1.8;
preampout = abs(xweighted.*1.8);
preampin = preampout;
pressure = 1000.*preampin./22.78;
pref = 0.00002;
pressure = sqrt(mean(pressure.^2));
AweightedSPL =20.*log10(pressure/pref);
figure(3);
plot(f,AweightedSPL,'b');grid
  8 comentarios
ZHU z
ZHU z el 12 de Abr. de 2022
thank you @Matt J
Sorry for the long wait, the input file has been uploaded~
ZHU z
ZHU z el 13 de Abr. de 2022
thank you, @Jeffrey Clark
I will go check it

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Audio Toolbox en Help Center y File Exchange.

Productos


Versión

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by